Changes in python/lib/aubio/__init__.py [7cfad8e:883b499]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/aubio/__init__.py
r7cfad8e r883b499 1 1 #! /usr/bin/env python 2 # -*- coding: utf8 -*-3 4 """5 aubio6 =====7 8 Provides a number of classes and functions for music and audio signal9 analysis.10 11 How to use the documentation12 ----------------------------13 14 Documentation of the python module is available as docstrings provided15 within the code, and a reference guide available online from `the16 aubio homepage <https://aubio.org/documentation>`_.17 18 The docstrings examples are written assuming `aubio` and `numpy` have been19 imported with:20 21 >>> import aubio22 >>> import numpy as np23 """24 2 25 3 import numpy … … 31 9 32 10 class fvec(numpy.ndarray): 33 """fvec(input_arg=1024, **kwargs) 34 A vector holding float samples. 11 """a numpy vector holding audio samples""" 35 12 36 If `input_arg` is an `int`, a 1-dimensional vector of length `input_arg`37 will be created and filled with zeros. Otherwise, if `input_arg` is an38 `array_like` object, it will be converted to a 1-dimensional vector of39 type :data:`float_type`.40 41 Parameters42 ----------43 input_arg : `int` or `array_like`44 Can be a positive integer, or any object that can be converted to45 a numpy array with :func:`numpy.array`.46 **kwargs47 Additional keyword arguments passed to :func:`numpy.zeros`, if48 `input_arg` is an integer, or to :func:`numpy.array`. Should not49 include `dtype`, which is already specified as50 :data:`aubio.float_type`.51 52 Returns53 -------54 numpy.ndarray55 Array of shape `(length,)`.56 57 Examples58 --------59 >>> aubio.fvec(10)60 array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], dtype=float32)61 >>> aubio.fvec([0,1,2])62 array([0., 1., 2.], dtype=float32)63 >>> a = np.arange(10); type(a), type(aubio.fvec(a))64 (<class 'numpy.ndarray'>, <class 'numpy.ndarray'>)65 >>> a.dtype, aubio.fvec(a).dtype66 (dtype('int64'), dtype('float32'))67 68 Notes69 -----70 71 In the Python world, `fvec` is simply a subclass of72 :class:`numpy.ndarray`. In practice, any 1-dimensional `numpy.ndarray` of73 `dtype` :data:`float_type` may be passed to methods accepting74 `fvec` as parameter. For instance, `sink()` or `pvoc()`.75 76 See Also77 --------78 cvec : a container holding spectral data79 numpy.ndarray : parent class of :class:`fvec`80 numpy.zeros : create a numpy array filled with zeros81 numpy.array : create a numpy array from an existing object82 """83 13 def __new__(cls, input_arg=1024, **kwargs): 84 14 if isinstance(input_arg, int):
Note: See TracChangeset
for help on using the changeset viewer.