Skip to content

Commit 4fdb858

Browse files
authored
Add files via upload
1 parent bb535a4 commit 4fdb858

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

trainset_preprocess_pipeline_print.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,13 @@ def norm_write(self, tmp_audio, idx0, idx1):
5959
wavfile.write(
6060
"%s/%s_%s.wav" % (self.gt_wavs_dir, idx0, idx1),
6161
self.sr,
62-
(tmp_audio * 1).astype(np.float32),
62+
tmp_audio.astype(np.float32),
6363
)
64-
65-
# default resample type of librosa.resample is "soxr_hq".
66-
# Quality: soxr_vhq > soxr_hq
67-
tmp_audio = librosa.resample(tmp_audio, orig_sr=self.sr, target_sr=16000, res_type="soxr_vhq")
68-
tmp_audio = (tmp_audio / np.abs(tmp_audio).max() * (self.max * self.alpha)) + (
69-
1 - self.alpha
70-
) * tmp_audio
71-
wavfile.write(
72-
"%s/%s_%s.wav" % (self.gt_wavs_dir, idx0, idx1),
73-
self.sr,
74-
(tmp_audio * 1).astype(np.float32),
75-
)
76-
64+
tmp_audio = librosa.resample(tmp_audio, orig_sr=self.sr, target_sr=16000)#, res_type="soxr_vhq"
7765
wavfile.write(
7866
"%s/%s_%s.wav" % (self.wavs16k_dir, idx0, idx1),
7967
16000,
80-
(tmp_audio * 1).astype(np.float32),
68+
tmp_audio.astype(np.float32),
8169
)
8270

8371
def pipeline(self, path, idx0):

0 commit comments

Comments
 (0)