From: Paul Brossier Date: Fri, 22 Mar 2013 17:35:26 +0000 (-0500) Subject: python/demos/demo_miditofreq.py: added simple miditofreq example X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c342c178a10c6fa31c99bd998a48ec80d097937a;p=aubio.git python/demos/demo_miditofreq.py: added simple miditofreq example --- 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()