Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -6,10 +6,10 @@ from .midiconv import * · 5 unmodified lines | ||
| 6 | 6 | from .slicing import * |
| 7 | 7 | |
| 8 | 8 | class fvec(numpy.ndarray): |
| 9 | − """a simple numpy array holding a vector of %s""" % float_type | |
| 9 | + """a numpy vector holding audio samples""" | |
| 10 | 10 | |
| 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) | |