-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_pyin.py
27 lines (23 loc) · 767 Bytes
/
test_pyin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import numpy as np
import pylab as pl
from revoice import *
from revoice.common import *
w, sr = loadWav("voices/yuri_orig.wav")
print("Direct...")
pyinAnalyzer = pyin.Analyzer(sr, prefilter = False)
obsProbList = pyinAnalyzer(w)
f0List = pyin.extractF0(obsProbList)
assert obsProbList.dtype == np.float32
assert f0List.dtype == np.float32
print("Prefiltered...")
pyinAnalyzer = pyin.Analyzer(sr)
obsProbList = pyinAnalyzer(w)
f0List_pf = pyin.extractF0(obsProbList)
assert obsProbList.dtype == np.float32
assert f0List_pf.dtype == np.float32
pl.plot(np.arange(w.shape[0]) / sr, w * 100)
tList = np.arange(f0List.shape[0]) * pyinAnalyzer.hopSize / sr
pl.plot(tList, f0List, label = "Direct")
pl.plot(tList, f0List_pf, label = "Prefiltered")
pl.legend()
pl.show()