source: python/lib/aubio/__init__.py @ 473ab11

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5sampleryinfft+
Last change on this file since 473ab11 was b96a7b8, checked in by Paul Brossier <piem@piem.org>, 9 years ago

python/lib/aubio/init.py: make sure length is not zero and float_type is imported

  • Property mode set to 100644
File size: 557 bytes
Line 
1#! /usr/bin/env python
2
3import numpy
4from ._aubio import *
5from ._aubio import float_type
6from .midiconv import *
7from .slicing import *
8
9class fvec(numpy.ndarray):
10    """a numpy vector holding audio samples"""
11
12    def __new__(cls, input_arg=1024, **kwargs):
13        if isinstance(input_arg, int):
14            if input_arg == 0:
15                raise ValueError("vector length of 1 or more expected")
16            return numpy.zeros(input_arg, dtype=float_type, **kwargs)
17        else:
18            return numpy.array(input_arg, dtype=float_type, **kwargs)
Note: See TracBrowser for help on using the repository browser.