peakLocs, peakMags, peakPhases ) trajLocs, trajMags = tracker.process( fft, peakiLocs, peakiMags ) specSynth = peakSynth.process( trajLocs, trajMags ) specSynth = specSynth[:,:plotSize] specMag = scipy.resize(spec, (1, spec.shape[0])) specMagResid = loudia.dbToMag( specMag ) - specSynth specResid = loudia.magToDb(loudia.dbToMag( specMag ) - specSynth)[0,:] specSynth = loudia.magToDb( specSynth )[0,:] trajsLocs.append( trajLocs[0,:] ) trajsMags.append( trajMags[0,:] ) specs.append( spec ) specsSynth.append( specSynth ) specsResid.append( specResid ) peakPos = peakLocs[peakLocs > 0] peakMags = peakMags[peakLocs > 0]
#!/usr/bin/env python import loudia import scipy import scipy.signal # Test the magToDb <-> dbToMag i = scipy.arange(1, 7, dtype = 'f4') a = loudia.magToDb(i) o = loudia.dbToMag(a) print 'magToDb/dbToMag:', scipy.allclose(i, o) # Test the transform of windows transf = loudia.hammingTransform(24, 10, 1024, 4096) # Test the poly function a = scipy.array([1, 2, 3, 4, 5]) rr = loudia.poly( a ) rs = scipy.poly( a ) print 'poly:', scipy.allclose(rr, rs) a = scipy.array([2, 0]) rr = loudia.poly( a ) rs = scipy.poly( a[:-1] ) print 'poly, plus zero:', scipy.allclose(rr[0,:-1], rs)
#!/usr/bin/env python import loudia import scipy import scipy.signal # Test the magToDb <-> dbToMag i = scipy.arange(1, 7, dtype='f4') a = loudia.magToDb(i) o = loudia.dbToMag(a) print 'magToDb/dbToMag:', scipy.allclose(i, o) # Test the transform of windows transf = loudia.hammingTransform(24, 10, 1024, 4096) # Test the poly function a = scipy.array([1, 2, 3, 4, 5]) rr = loudia.poly(a) rs = scipy.poly(a) print 'poly:', scipy.allclose(rr, rs) a = scipy.array([2, 0]) rr = loudia.poly(a) rs = scipy.poly(a[:-1]) print 'poly, plus zero:', scipy.allclose(rr[0, :-1], rs)