OlaWod commited on
Commit
b562f6f
1 Parent(s): a1b3011

support tune f0

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -55,10 +55,10 @@ def tune_f0(initial_f0, i):
55
  if i == 0:
56
  return initial_f0
57
  voiced = initial_f0 > threshold
58
- initial_lf0 = torch.log(initial_f0)
59
  lf0 = initial_lf0 + step * i
60
- f0 = torch.exp(lf0)
61
- f0 = torch.where(voiced, f0, initial_f0)
62
  return f0
63
 
64
  # infer
@@ -98,6 +98,7 @@ def convert(tgt_spk, src_wav, f0_shift=0):
98
 
99
  f0_mean_tgt = f0_stats[tgt_spk]["mean"]
100
  f0_mean_tgt = np.array([f0_mean_tgt], dtype=np.float32)[None, :]
 
101
 
102
  # src
103
  wav, sr = librosa.load(src_wav, sr=16000)
 
55
  if i == 0:
56
  return initial_f0
57
  voiced = initial_f0 > threshold
58
+ initial_lf0 = np.log(initial_f0)
59
  lf0 = initial_lf0 + step * i
60
+ f0 = np.exp(lf0)
61
+ f0 = np.where(voiced, f0, initial_f0)
62
  return f0
63
 
64
  # infer
 
98
 
99
  f0_mean_tgt = f0_stats[tgt_spk]["mean"]
100
  f0_mean_tgt = np.array([f0_mean_tgt], dtype=np.float32)[None, :]
101
+ f0_mean_tgt = tune_f0(f0_mean_tgt, f0_shift)
102
 
103
  # src
104
  wav, sr = librosa.load(src_wav, sr=16000)