ref: ccca7cb61f06d706246e17e7aeb9f3cd16cd5865
parent: 2a109e4ee1f09fe440cd0b776134440ad9dcd6bc
author: Paul Brossier <piem@piem.org>
date: Sun Dec 20 15:20:14 EST 2009
aubio/__init__.py: added python helper for fvec and cvec
--- /dev/null
+++ b/interfaces/python/aubio/__init__.py
@@ -1,0 +1,20 @@
+import numpy
+
+class fvec(numpy.ndarray):
+
+ def __init__(self, length = 1024, **kwargs):
+ super(numpy.ndarray, self).__init__(**kwargs)
+
+ def __new__(self, length = 1024, **kwargs):
+ self = numpy.zeros(length, dtype='float32', **kwargs)
+ return self
+
+class cvec:
+
+ def __init__ (self, length = 1024, **kwargs):
+ self.norm = numpy.zeros(length / 2 + 1, dtype='float32', **kwargs)
+ self.phas = numpy.zeros(length / 2 + 1, dtype='float32', **kwargs)
+
+ def __len__ (self):
+ assert len(self.norm) == len(self.phas)
+ return len(self.norm)