projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
016813e
)
python/lib/aubio/__init__.py: clean up, use isinstance
author
Paul Brossier
<piem@piem.org>
Tue, 10 May 2016 19:37:37 +0000
(21:37 +0200)
committer
Paul Brossier
<piem@piem.org>
Tue, 10 May 2016 19:37:37 +0000
(21:37 +0200)
python/lib/aubio/__init__.py
patch
|
blob
|
history
diff --git
a/python/lib/aubio/__init__.py
b/python/lib/aubio/__init__.py
index
431f719
..
8e320f4
100644
(file)
--- a/
python/lib/aubio/__init__.py
+++ b/
python/lib/aubio/__init__.py
@@
-6,10
+6,10
@@
from .midiconv import *
from .slicing import *
class fvec(numpy.ndarray):
from .slicing import *
class fvec(numpy.ndarray):
- """a
simple numpy array holding a vector of %s""" % float_type
+ """a
numpy vector holding audio samples"""
- def __new__(
self, length =
1024, **kwargs):
- self.length = length
- if type(length) == type([]):
- return numpy.array(length, dtype = float_type, **kwargs)
-
return numpy.zeros(length, dtype =
float_type, **kwargs)
+ def __new__(
cls, input_arg=
1024, **kwargs):
+ if isinstance(input_arg, int):
+ return numpy.zeros(input_arg, dtype=float_type, **kwargs)
+ else:
+
return numpy.array(input_arg, dtype=
float_type, **kwargs)