Changeset 143682b for python/lib/aubio


Ignore:
Timestamp:
May 10, 2016, 9:37:37 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
8fb567c
Parents:
016813e
Message:

python/lib/aubio/init.py: clean up, use isinstance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/lib/aubio/__init__.py

    r016813e r143682b  
    77
    88class fvec(numpy.ndarray):
    9     """a simple numpy array holding a vector of %s""" % float_type
     9    """a numpy vector holding audio samples"""
    1010
    11     def __new__(self, length = 1024, **kwargs):
    12         self.length = length
    13         if type(length) == type([]):
    14             return numpy.array(length, dtype = float_type, **kwargs)
    15         return numpy.zeros(length, dtype = float_type, **kwargs)
     11    def __new__(cls, input_arg=1024, **kwargs):
     12        if isinstance(input_arg, int):
     13            return numpy.zeros(input_arg, dtype=float_type, **kwargs)
     14        else:
     15            return numpy.array(input_arg, dtype=float_type, **kwargs)
Note: See TracChangeset for help on using the changeset viewer.