From: Paul Brossier Date: Sun, 16 Sep 2007 23:00:51 +0000 (+0200) Subject: removed plotmat.py, modified plotfb.py to build filterbank on the fly, moved to pytho... X-Git-Tag: bzr2git~442^2~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3730d9460e30fd1a413925b3f9fa27d05b7218f6;p=aubio.git removed plotmat.py, modified plotfb.py to build filterbank on the fly, moved to python/test --- diff --git a/examples/plotfb.py b/examples/plotfb.py deleted file mode 100755 index 4592c139..00000000 --- a/examples/plotfb.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python - -import pylab -import numpy -import sys - - -filename=sys.argv[1] - -doLog=False -if len(sys.argv)>2: - if sys.argv[2]=='log': - doLog=True - -mat = pylab.load(filename) -nmat= numpy.array(mat) -print numpy.shape(nmat) - -pylab.hold(True) - -n_filters=numpy.shape(nmat)[0] -for i in range(n_filters): - if doLog==True: - pylab.semilogx(nmat[i,:]) - else: - pylab.plot(nmat[i,:]) - - -pylab.hold(False) -pylab.show() \ No newline at end of file diff --git a/examples/plotmat.py b/examples/plotmat.py deleted file mode 100755 index f88f5e83..00000000 --- a/examples/plotmat.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python - -import pylab -import numpy -import sys - -filename=sys.argv[1] - -mat=pylab.load(filename) -nmat=numpy.array(mat).T -print numpy.shape(nmat) - - -pylab.matshow(nmat, cmap=pylab.cm.gray, aspect='auto') -#pylab.imshow(nmat, cmap=pylab.cm.gray, aspect='auto', interpolation=False) -#pylab.contour(nmat, cmap=pylab.cm.gray, aspect='auto') - -pylab.show() \ No newline at end of file diff --git a/python/test/plot_mfcc_filterbank.py b/python/test/plot_mfcc_filterbank.py new file mode 100755 index 00000000..fb527f02 --- /dev/null +++ b/python/test/plot_mfcc_filterbank.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +import pylab +import numpy +import sys + +from aubio.aubiowrapper import * + +win_size = 2048 +channels = 1 +n_filters = 40 +samplerate = 44100 + +filterbank = new_aubio_filterbank_mfcc(n_filters, win_size, samplerate, + 0., samplerate) + + +mfcc_filters = [] +for channel in range(n_filters): + vec = aubio_filterbank_getchannel(filterbank,channel) + mfcc_filters.append([]) + for index in range(win_size): + mfcc_filters[channel].append(fvec_read_sample(vec,0,index)) + +doLog=False +if len(sys.argv)>1: + if sys.argv[1]=='log': + doLog=True + +nmat= numpy.array(mfcc_filters) + +pylab.hold(True) + +n_filters=numpy.shape(nmat)[0] +for i in range(n_filters): + if doLog==True: + pylab.semilogx(nmat[i,:]) + else: + pylab.plot(nmat[i,:]) + +pylab.hold(False) +#pylab.savefig('test.png') +pylab.show()