Kangarroar commited on
Commit
e3b4214
1 Parent(s): 83b7afc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -16
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
-    # If the formant shift ratio is not equal to 1.0, change the gender of the sound using parselmouth
54
-    if formant_shift_ratio != 1.0:
55
-        sound = parselmouth.Sound(wav_gen)
56
-        print(wav_gen)
57
-        Audio(data=sound.values, rate=sound.sampling_frequency)
58
-        sound.get_power()
59
-        sampling_rate = sound.sampling_frequency
60
-        print(sampling_rate)
61
-        resampled_sound = sound.resample(sampling_rate)
62
-        print(resampled_sound)
63
-        factor = formant_shift_ratio
64
-        print(factor)
65
-        manipulated_sound = call(sound, "Change gender", 75, 500, factor, 0, 1, 1)
66
-        print(manipulated_sound)
67
-        manipulated_sound.save("que.wav", "WAV")
68
-        print("Gender correct!") use_gt_mel=use_mel_as_base, add_noise_step=noise_step,project_name=project_name,out_path=wav_gen)
 
 
 
 
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