source: tests/demo/plot_mfcc_filterbank.py @ 9ea88c6

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 9ea88c6 was 974dddc, checked in by Paul Brossier <piem@piem.org>, 17 years ago

move tests/python/demo to tests/, add localaubio.py module helpers

  • Property mode set to 100755
File size: 807 bytes
Line 
1#!/usr/bin/env python
2
3import pylab
4import numpy
5import sys
6
7from localaubio import *
8
9win_size = 2048 
10channels = 1
11n_filters = 40
12samplerate = 44100
13
14filterbank = new_aubio_filterbank_mfcc(n_filters, win_size, samplerate, 
15        0., samplerate) 
16
17mfcc_filters = []
18for channel in range(n_filters):
19  vec = aubio_filterbank_getchannel(filterbank,channel)
20  mfcc_filters.append([])
21  for index in range(win_size): 
22    mfcc_filters[channel].append(fvec_read_sample(vec,0,index))
23
24doLog=False
25if len(sys.argv)>1: 
26  if sys.argv[1]=='log':
27    doLog=True
28
29nmat= numpy.array(mfcc_filters)
30
31pylab.hold(True)
32
33n_filters=numpy.shape(nmat)[0]
34for i in range(n_filters):
35  if doLog==True:
36    pylab.semilogx(nmat[i,:])
37  else:
38    pylab.plot(nmat[i,:]) 
39
40pylab.hold(False)
41#pylab.savefig('test.png')
42pylab.show()
Note: See TracBrowser for help on using the repository browser.