feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change
on this file since e458af4 was
4120fbc,
checked in by Paul Brossier <piem@piem.org>, 9 years ago
|
python/demos: python3 and double precision compatibility
|
-
Property mode set to
100755
|
File size:
783 bytes
|
Line | |
---|
1 | #! /usr/bin/env python |
---|
2 | |
---|
3 | from aubio import filterbank, fvec |
---|
4 | from pylab import loglog, show, xlim, ylim, xlabel, ylabel, title |
---|
5 | from numpy import vstack, arange |
---|
6 | |
---|
7 | win_s = 2048 |
---|
8 | samplerate = 48000 |
---|
9 | |
---|
10 | freq_list = [60, 80, 200, 400, 800, 1600, 3200, 6400, 12800, 24000] |
---|
11 | n_filters = len(freq_list) - 2 |
---|
12 | |
---|
13 | f = filterbank(n_filters, win_s) |
---|
14 | freqs = fvec(freq_list) |
---|
15 | f.set_triangle_bands(freqs, samplerate) |
---|
16 | |
---|
17 | coeffs = f.get_coeffs() |
---|
18 | coeffs[4] *= 5. |
---|
19 | |
---|
20 | f.set_coeffs(coeffs) |
---|
21 | |
---|
22 | times = vstack([arange(win_s // 2 + 1) * samplerate / win_s] * n_filters) |
---|
23 | title('Bank of filters built using a simple list of boundaries\nThe middle band has been amplified by 2.') |
---|
24 | loglog(times.T, f.get_coeffs().T, '.-') |
---|
25 | xlim([50, samplerate/2]) |
---|
26 | ylim([1.0e-6, 2.0e-2]) |
---|
27 | xlabel('log frequency (Hz)') |
---|
28 | ylabel('log amplitude') |
---|
29 | |
---|
30 | show() |
---|
Note: See
TracBrowser
for help on using the repository browser.