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
14
- import librosa
13
+ import soundfile as sf
14
+ # import librosa
15
15
import pyworld as pw
16
16
17
17
@@ -56,8 +56,8 @@ def main(args):
56
56
rmtree ('test' )
57
57
os .mkdir ('test' )
58
58
59
- # x, fs = sf.read('utterance/vaiueo2d.wav')
60
- x , fs = librosa .load ('utterance/vaiueo2d.wav' , dtype = np .float64 )
59
+ x , fs = sf .read ('utterance/vaiueo2d.wav' )
60
+ # x, fs = librosa.load('utterance/vaiueo2d.wav', dtype=np.float64)
61
61
62
62
# 1. A convient way
63
63
f0 , sp , ap , pyDioOpt = pw .wav2world (x , fs ) # use default options
@@ -76,14 +76,17 @@ def main(args):
76
76
_sp = pw .cheaptrick (x , _f0 , t , fs )
77
77
_ap = pw .d4c (x , _f0 , t , fs )
78
78
_y = pw .synthesize (_f0 , _sp , _ap , fs , pyDioOpt .option ['frame_period' ])
79
- librosa .output .write_wav ('test/y_without_f0_refinement.wav' , _y , fs )
79
+ # librosa.output.write_wav('test/y_without_f0_refinement.wav', _y, fs)
80
+ sf .write ('test/y_without_f0_refinement.wav' , _y , fs )
81
+
80
82
81
83
# 2-2 With F0 refinement (using stonemask)
82
84
f0 = pw .stonemask (x , _f0 , t , fs )
83
85
sp = pw .cheaptrick (x , f0 , t , fs )
84
86
ap = pw .d4c (x , f0 , t , fs )
85
87
y = pw .synthesize (f0 , sp , ap , fs , pyDioOpt .option ['frame_period' ])
86
- librosa .output .write_wav ('test/y_with_f0_refinement.wav' , y , fs )
88
+ # librosa.output.write_wav('test/y_with_f0_refinement.wav', y, fs)
89
+ sf .write ('test/y_with_f0_refinement.wav' , y , fs )
87
90
88
91
# Comparison
89
92
savefig ('test/wavform.png' , [x , _y , y ])
0 commit comments