From c342c178a10c6fa31c99bd998a48ec80d097937a Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Fri, 22 Mar 2013 12:35:26 -0500 Subject: [PATCH] python/demos/demo_miditofreq.py: added simple miditofreq example --- python/demos/demo_miditofreq.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 python/demos/demo_miditofreq.py diff --git a/python/demos/demo_miditofreq.py b/python/demos/demo_miditofreq.py new file mode 100755 index 00000000..c325fb50 --- /dev/null +++ b/python/demos/demo_miditofreq.py @@ -0,0 +1,17 @@ +#! /usr/bin/env python + +from aubio import miditofreq +from numpy import arange + +upsampling = 100. +midi = arange(-10, 148 * upsampling) +midi /= upsampling +freq = miditofreq(midi) + +from matplotlib import pyplot as plt + +ax = plt.axes() +ax.semilogy(midi, freq, '.') +ax.set_xlabel('midi note') +ax.set_ylabel('frequency (Hz)') +plt.show() -- 2.26.2