summaryrefslogtreecommitdiff
path: root/python/demos/demo_miditofreq.py
blob: c325fb50d002190ade5cdc6138f588ece9d9b0a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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()