10
10
matplotlib .use ('Agg' ) # Remove this line if you don't need them
11
11
import matplotlib .pyplot as plt
12
12
13
- import soundfile as sf
13
+ # import soundfile as sf
14
+ import librosa
14
15
import pyworld as pw
15
16
16
17
@@ -55,7 +56,8 @@ def main(args):
55
56
rmtree ('test' )
56
57
os .mkdir ('test' )
57
58
58
- x , fs = sf .read ('utterance/vaiueo2d.wav' )
59
+ # x, fs = sf.read('utterance/vaiueo2d.wav')
60
+ x , fs = librosa .load ('utterance/vaiueo2d.wav' )
59
61
60
62
# 1. A convient way
61
63
f0 , sp , ap , pyDioOpt = pw .wav2world (x , fs ) # use default options
@@ -74,14 +76,14 @@ def main(args):
74
76
_sp = pw .cheaptrick (x , _f0 , t , fs )
75
77
_ap = pw .d4c (x , _f0 , t , fs )
76
78
_y = pw .synthesize (_f0 , _sp , _ap , fs , pyDioOpt .option ['frame_period' ])
77
- sf . write ('test/y_without_f0_refinement.wav' , _y , fs )
79
+ librosa . output . write_wav ('test/y_without_f0_refinement.wav' , _y , fs )
78
80
79
81
# 2-2 With F0 refinement (using stonemask)
80
82
f0 = pw .stonemask (x , _f0 , t , fs )
81
83
sp = pw .cheaptrick (x , f0 , t , fs )
82
84
ap = pw .d4c (x , f0 , t , fs )
83
85
y = pw .synthesize (f0 , sp , ap , fs , pyDioOpt .option ['frame_period' ])
84
- sf . write ('test/y_with_f0_refinement.wav' , y , fs )
86
+ librosa . output . write_wav ('test/y_with_f0_refinement.wav' , y , fs )
85
87
86
88
# Comparison
87
89
savefig ('test/wavform.png' , [x , _y , y ])
0 commit comments