From: Paul Brossier Date: Sun, 10 Feb 2013 01:49:24 +0000 (-0500) Subject: moved demos to subdirectory X-Git-Tag: 0.4.0-beta1~335^2~19 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=ce12f3ad40f94b6b670f0cf100f5efc9eb5be835;p=aubio.git moved demos to subdirectory --- diff --git a/python/demo_filterbank_slaney.py b/python/demo_filterbank_slaney.py deleted file mode 100755 index 636dc809..00000000 --- a/python/demo_filterbank_slaney.py +++ /dev/null @@ -1,21 +0,0 @@ -#! /usr/bin/env python - -from aubio import filterbank -from numpy import array, arange, vstack - -win_s = 8192 -samplerate = 16000 - -f = filterbank(40, win_s) -f.set_mel_coeffs_slaney(samplerate) - -from pylab import loglog, title, show, xlim, ylim, xlabel, ylabel -xlim([0,samplerate / 2]) -times = vstack([arange(win_s / 2 + 1) * samplerate / win_s] * 40) -loglog(times.T, f.get_coeffs().T, '.-') -title('Mel frequency bands coefficients') -xlim([100, 7500]) -ylim([1.0e-3, 2.0e-2]) -xlabel('Frequency (Hz)') -ylabel('Amplitude') -show() diff --git a/python/demo_filterbank_triangle_bands.py b/python/demo_filterbank_triangle_bands.py deleted file mode 100755 index 7b02e7d9..00000000 --- a/python/demo_filterbank_triangle_bands.py +++ /dev/null @@ -1,47 +0,0 @@ -#! /usr/bin/env python - -from aubio import filterbank, fvec -from pylab import loglog, show, subplot, xlim, ylim, xlabel, ylabel, title -from numpy import vstack, arange - -win_s = 2048 -samplerate = 48000 - -freq_list = [60, 80, 200, 400, 800, 1600, 3200, 6400, 12800, 24000] -n_filters = len(freq_list) - 2 - -f = filterbank(n_filters, win_s) -freqs = fvec(freq_list) -f.set_triangle_bands(freqs, samplerate) - -subplot(211) -title('Examples of filterbank built with set_triangle_bands and set_coeffs') -times = vstack([arange(win_s / 2 + 1) * samplerate / win_s] * n_filters) -loglog(times.T, f.get_coeffs().T, '.-') -xlim([50, samplerate/2]) -ylim([1.0e-6, 2.0e-2]) -ylabel('Amplitude') - -## build a new filterbank - -freq_list = [60, 80, 200, 400, 800, 1200, 1600, 3200, 6400, 10000, 15000, 24000] -n_filters = len(freq_list) - 2 - -f = filterbank(n_filters, win_s) -freqs = fvec(freq_list) -f.set_triangle_bands(freqs, samplerate) - -coeffs = f.get_coeffs() -coeffs[4] *= 5. - -f.set_coeffs(coeffs) - -subplot(212) -times = vstack([arange(win_s / 2 + 1) * samplerate / win_s] * n_filters) -loglog(times.T, f.get_coeffs().T, '.-') -xlim([50, samplerate/2]) -ylim([1.0e-6, 2.0e-2]) -xlabel('Frequency (Hz)') -ylabel('Amplitude') - -show() diff --git a/python/demos/demo_filterbank_slaney.py b/python/demos/demo_filterbank_slaney.py new file mode 100755 index 00000000..636dc809 --- /dev/null +++ b/python/demos/demo_filterbank_slaney.py @@ -0,0 +1,21 @@ +#! /usr/bin/env python + +from aubio import filterbank +from numpy import array, arange, vstack + +win_s = 8192 +samplerate = 16000 + +f = filterbank(40, win_s) +f.set_mel_coeffs_slaney(samplerate) + +from pylab import loglog, title, show, xlim, ylim, xlabel, ylabel +xlim([0,samplerate / 2]) +times = vstack([arange(win_s / 2 + 1) * samplerate / win_s] * 40) +loglog(times.T, f.get_coeffs().T, '.-') +title('Mel frequency bands coefficients') +xlim([100, 7500]) +ylim([1.0e-3, 2.0e-2]) +xlabel('Frequency (Hz)') +ylabel('Amplitude') +show() diff --git a/python/demos/demo_filterbank_triangle_bands.py b/python/demos/demo_filterbank_triangle_bands.py new file mode 100755 index 00000000..7b02e7d9 --- /dev/null +++ b/python/demos/demo_filterbank_triangle_bands.py @@ -0,0 +1,47 @@ +#! /usr/bin/env python + +from aubio import filterbank, fvec +from pylab import loglog, show, subplot, xlim, ylim, xlabel, ylabel, title +from numpy import vstack, arange + +win_s = 2048 +samplerate = 48000 + +freq_list = [60, 80, 200, 400, 800, 1600, 3200, 6400, 12800, 24000] +n_filters = len(freq_list) - 2 + +f = filterbank(n_filters, win_s) +freqs = fvec(freq_list) +f.set_triangle_bands(freqs, samplerate) + +subplot(211) +title('Examples of filterbank built with set_triangle_bands and set_coeffs') +times = vstack([arange(win_s / 2 + 1) * samplerate / win_s] * n_filters) +loglog(times.T, f.get_coeffs().T, '.-') +xlim([50, samplerate/2]) +ylim([1.0e-6, 2.0e-2]) +ylabel('Amplitude') + +## build a new filterbank + +freq_list = [60, 80, 200, 400, 800, 1200, 1600, 3200, 6400, 10000, 15000, 24000] +n_filters = len(freq_list) - 2 + +f = filterbank(n_filters, win_s) +freqs = fvec(freq_list) +f.set_triangle_bands(freqs, samplerate) + +coeffs = f.get_coeffs() +coeffs[4] *= 5. + +f.set_coeffs(coeffs) + +subplot(212) +times = vstack([arange(win_s / 2 + 1) * samplerate / win_s] * n_filters) +loglog(times.T, f.get_coeffs().T, '.-') +xlim([50, samplerate/2]) +ylim([1.0e-6, 2.0e-2]) +xlabel('Frequency (Hz)') +ylabel('Amplitude') + +show()