Spaces:
Configuration error
Configuration error
Kangarroar
commited on
Commit
•
e3b4214
1
Parent(s):
83b7afc
Update app.py
Browse files
app.py
CHANGED
@@ -50,22 +50,26 @@ def render_audio(ckpt_temp_file, config_temp_file, audio_temp_file, title, title
|
|
50 |
with st.spinner("Rendering Audio..."):
|
51 |
f0_tst, f0_pred, audio = run_clip(svc_model,file_path=wav_fn, key=key, acc=title2, use_crepe=Crepe, use_pe=False, thre=0.05,
|
52 |
use_gt_mel=use_mel_as_base, add_noise_step=noise_step,project_name=project_name,out_path=wav_gen)
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
69 |
clip_completed = True
|
70 |
if clip_completed:
|
71 |
|
|
|
50 |
with st.spinner("Rendering Audio..."):
|
51 |
f0_tst, f0_pred, audio = run_clip(svc_model,file_path=wav_fn, key=key, acc=title2, use_crepe=Crepe, use_pe=False, thre=0.05,
|
52 |
use_gt_mel=use_mel_as_base, add_noise_step=noise_step,project_name=project_name,out_path=wav_gen)
|
53 |
+
##PRAAT
|
54 |
+
formant_shift_ratio_str = title3
|
55 |
+
formant_shift_ratio = float(formant_shift_ratio_str)
|
56 |
+
|
57 |
+
# If the formant shift ratio is not equal to 1.0, change the gender of the sound using parselmouth
|
58 |
+
if formant_shift_ratio != 1.0:
|
59 |
+
sound = parselmouth.Sound(wav_gen)
|
60 |
+
print(wav_gen)
|
61 |
+
Audio(data=sound.values, rate=sound.sampling_frequency)
|
62 |
+
sound.get_power()
|
63 |
+
sampling_rate = sound.sampling_frequency
|
64 |
+
print(sampling_rate)
|
65 |
+
resampled_sound = sound.resample(sampling_rate)
|
66 |
+
print(resampled_sound)
|
67 |
+
factor = formant_shift_ratio
|
68 |
+
print(factor)
|
69 |
+
manipulated_sound = call(sound, "Change gender", 75, 500, factor, 0, 1, 1)
|
70 |
+
print(manipulated_sound)
|
71 |
+
manipulated_sound.save("que.wav", "WAV")
|
72 |
+
print("Gender correct!") use_gt_mel=use_mel_as_base, add_noise_step=noise_step,project_name=project_name,out_path=wav_gen)
|
73 |
clip_completed = True
|
74 |
if clip_completed:
|
75 |
|