shithub: aubio

Download patch

ref: c342c178a10c6fa31c99bd998a48ec80d097937a
parent: 86ad5462e927ddf5d71fa7f630b8584f19dbd54a
author: Paul Brossier <piem@piem.org>
date: Fri Mar 22 08:35:26 EDT 2013

python/demos/demo_miditofreq.py: added simple miditofreq example

--- /dev/null
+++ b/python/demos/demo_miditofreq.py
@@ -1,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()