Mercurial > hg > vampy
comparison Example VamPy plugins/PyMFCC.py @ 67:146d14ab15e7
Debug output: off by default, on with VAMPY_VERBOSE environment variable
author | Chris Cannam |
---|---|
date | Mon, 17 Nov 2014 10:03:44 +0000 |
parents | d56f48aafb99 |
children | 44d56a3d16b7 |
comparison
equal
deleted
inserted
replaced
66:5664fe298af2 | 67:146d14ab15e7 |
---|---|
50 # make sure this will run only once | 50 # make sure this will run only once |
51 # if called from a vamp process | 51 # if called from a vamp process |
52 if self.updated: return self.valid | 52 if self.updated: return self.valid |
53 self.updated = True | 53 self.updated = True |
54 self.valid = False | 54 self.valid = False |
55 print 'Updating parameters and recalculating filters: ' | 55 # print 'Updating parameters and recalculating filters: ' |
56 print 'Nyquist: ',self.NqHz | 56 # print 'Nyquist: ',self.NqHz |
57 | 57 |
58 if self.maxHz > self.NqHz : | 58 if self.maxHz > self.NqHz : |
59 raise Exception('Maximum frequency must be smaller than the Nyquist frequency') | 59 raise Exception('Maximum frequency must be smaller than the Nyquist frequency') |
60 | 60 |
61 self.maxMel = 1000*log(1+self.maxHz/700.0)/log(1+1000.0/700.0) | 61 self.maxMel = 1000*log(1+self.maxHz/700.0)/log(1+1000.0/700.0) |
62 self.minMel = 1000*log(1+self.minHz/700.0)/log(1+1000.0/700.0) | 62 self.minMel = 1000*log(1+self.minHz/700.0)/log(1+1000.0/700.0) |
63 print 'minHz:%s\nmaxHz:%s\nminMel:%s\nmaxMel:%s\n' \ | 63 # print 'minHz:%s\nmaxHz:%s\nminMel:%s\nmaxMel:%s\n' \ |
64 %(self.minHz,self.maxHz,self.minMel,self.maxMel) | 64 # %(self.minHz,self.maxHz,self.minMel,self.maxMel) |
65 self.filterMatrix = self.getFilterMatrix(self.inputSize,self.numBands) | 65 self.filterMatrix = self.getFilterMatrix(self.inputSize,self.numBands) |
66 self.DCTMatrix = self.getDCTMatrix(self.numBands) | 66 self.DCTMatrix = self.getDCTMatrix(self.numBands) |
67 self.filterIter = self.filterMatrix.__iter__() | 67 self.filterIter = self.filterMatrix.__iter__() |
68 self.valid = True | 68 self.valid = True |
69 return self.valid | 69 return self.valid |
122 class PyMFCC(melScaling): | 122 class PyMFCC(melScaling): |
123 | 123 |
124 def __init__(self,inputSampleRate): | 124 def __init__(self,inputSampleRate): |
125 | 125 |
126 # flags for setting some Vampy options | 126 # flags for setting some Vampy options |
127 self.vampy_flags = vf_DEBUG | vf_ARRAY | vf_REALTIME | 127 self.vampy_flags = vf_ARRAY | vf_REALTIME |
128 | 128 |
129 self.m_inputSampleRate = int(inputSampleRate) | 129 self.m_inputSampleRate = int(inputSampleRate) |
130 self.m_stepSize = 1024 | 130 self.m_stepSize = 1024 |
131 self.m_blockSize = 2048 | 131 self.m_blockSize = 2048 |
132 self.m_channels = 1 | 132 self.m_channels = 1 |