summaryrefslogtreecommitdiff
path: root/examples/plotpartials.py
blob: 89cc53b60b4e8414e5a2a3717f2fc21286e3b32e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import sys
import matplotlib.pyplot as plt
import simpl

usage = 'Usage: python {0} <wav file>'.format(__file__)
if len(sys.argv) != 2:
    print(usage)
    sys.exit(1)

audio = simpl.read_wav(sys.argv[1])[0]

pd = simpl.LorisPeakDetection()
pd.max_peaks = 30
frames = pd.find_peaks(audio)
pt = simpl.MQPartialTracking()
pt.max_partials = 30
frames = pt.find_partials(frames)
simpl.plot_partials(frames, show_peaks=False)
plt.show()