feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since 03c3450 was
ccca7cb,
checked in by Paul Brossier <piem@piem.org>, 15 years ago
|
aubio/init.py: added python helper for fvec and cvec
|
-
Property mode set to
100644
|
File size:
593 bytes
|
Line | |
---|
1 | import numpy |
---|
2 | |
---|
3 | class fvec(numpy.ndarray): |
---|
4 | |
---|
5 | def __init__(self, length = 1024, **kwargs): |
---|
6 | super(numpy.ndarray, self).__init__(**kwargs) |
---|
7 | |
---|
8 | def __new__(self, length = 1024, **kwargs): |
---|
9 | self = numpy.zeros(length, dtype='float32', **kwargs) |
---|
10 | return self |
---|
11 | |
---|
12 | class cvec: |
---|
13 | |
---|
14 | def __init__ (self, length = 1024, **kwargs): |
---|
15 | self.norm = numpy.zeros(length / 2 + 1, dtype='float32', **kwargs) |
---|
16 | self.phas = numpy.zeros(length / 2 + 1, dtype='float32', **kwargs) |
---|
17 | |
---|
18 | def __len__ (self): |
---|
19 | assert len(self.norm) == len(self.phas) |
---|
20 | return len(self.norm) |
---|
Note: See
TracBrowser
for help on using the repository browser.