Changeset 78c1d32
 Timestamp:
 Oct 30, 2018, 5:57:27 PM (6 years ago)
 Branches:
 feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
 Children:
 7cfad8e
 Parents:
 6d8ae981
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

python/lib/aubio/__init__.py
r6d8ae981 r78c1d32 9 9 10 10 class fvec(numpy.ndarray): 11 """a numpy vector holding audio samples""" 11 """fvec(input_arg=1024, **kwargs) 12 A vector holding float samples. 12 13 14 If `input_arg` is an `int`, a 1dimensional vector of length `input_arg` 15 will be created and filled with zeros. Otherwise, if `input_arg` is an 16 `array_like` object, it will be converted to a 1dimensional vector of 17 type :data:`float_type`. 18 19 Parameters 20  21 input_arg : `int` or `array_like` 22 Can be a positive integer, or any object that can be converted to 23 a numpy array with :func:`numpy.array`. 24 **kwargs 25 Additional keyword arguments passed to :func:`numpy.zeros`, if 26 `input_arg` is an integer, or to :func:`numpy.array`. Should not 27 include `dtype`, which is already specified as 28 :data:`aubio.float_type`. 29 30 Returns 31  32 numpy.ndarray 33 Array of shape `(length,)`. 34 35 Examples 36  37 >>> aubio.fvec(10) 38 array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], dtype=float32) 39 >>> aubio.fvec([0,1,2]) 40 array([0., 1., 2.], dtype=float32) 41 >>> a = np.arange(10); type(a), type(aubio.fvec(a)) 42 (<class 'numpy.ndarray'>, <class 'numpy.ndarray'>) 43 >>> a.dtype, aubio.fvec(a).dtype 44 (dtype('int64'), dtype('float32')) 45 46 Notes 47  48 49 In the Python world, `fvec` is simply a subclass of 50 :class:`numpy.ndarray`. In practice, any 1dimensional `numpy.ndarray` of 51 `dtype` :data:`float_type` may be passed to methods accepting 52 `fvec` as parameter. For instance, `sink()` or `pvoc()`. 53 54 See Also 55  56 cvec : a container holding spectral data 57 numpy.ndarray : parent class of :class:`fvec` 58 numpy.zeros : create a numpy array filled with zeros 59 numpy.array : create a numpy array from an existing object 60 """ 13 61 def __new__(cls, input_arg=1024, **kwargs): 14 62 if isinstance(input_arg, int):
Note: See TracChangeset
for help on using the changeset viewer.