Spaces:
Running
on
Zero
Running
on
Zero
刘悦
commited on
Update file_utils.py
Browse files
cosyvoice/utils/file_utils.py
CHANGED
@@ -40,14 +40,14 @@ def load_wav(wav, target_sr):
|
|
40 |
speech = torchaudio.transforms.Resample(orig_freq=sample_rate, new_freq=target_sr)(speech)
|
41 |
return speech
|
42 |
|
43 |
-
def speed_change(waveform,sample_rate,speed_factor:str):
|
44 |
effects = [
|
45 |
-
|
46 |
-
|
47 |
]
|
48 |
augmented_waveform, new_sample_rate = torchaudio.sox_effects.apply_effects_tensor(
|
49 |
-
waveform,
|
50 |
-
sample_rate,
|
51 |
effects
|
52 |
)
|
53 |
return augmented_waveform, new_sample_rate
|
|
|
40 |
speech = torchaudio.transforms.Resample(orig_freq=sample_rate, new_freq=target_sr)(speech)
|
41 |
return speech
|
42 |
|
43 |
+
def speed_change(waveform, sample_rate, speed_factor: str):
|
44 |
effects = [
|
45 |
+
["tempo", speed_factor], # speed_factor
|
46 |
+
["rate", f"{sample_rate}"]
|
47 |
]
|
48 |
augmented_waveform, new_sample_rate = torchaudio.sox_effects.apply_effects_tensor(
|
49 |
+
waveform,
|
50 |
+
sample_rate,
|
51 |
effects
|
52 |
)
|
53 |
return augmented_waveform, new_sample_rate
|