shithub: aubio

ref: 7af37df141c7342e302f89fdf0442a04f932f0b6
dir: /python/demos/demo_miditofreq.py/

View raw version
#! /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()