source: python/lib/aubio/__init__.py @ ea7428a

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since ea7428a 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
RevLine 
[229d050]1#! /usr/bin/env python
2
[ccca7cb]3import numpy
[4de5f35]4from ._aubio import *
[b96a7b8]5from ._aubio import float_type
[4de5f35]6from .midiconv import *
7from .slicing import *
[ccca7cb]8
9class fvec(numpy.ndarray):
[143682b]10    """a numpy vector holding audio samples"""
[8bffcff]11
[143682b]12    def __new__(cls, input_arg=1024, **kwargs):
13        if isinstance(input_arg, int):
[b96a7b8]14            if input_arg == 0:
15                raise ValueError("vector length of 1 or more expected")
[143682b]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.