zyingt commited on
Commit
73880c7
1 Parent(s): 2023a17

support timbre confusion

Browse files
Files changed (1) hide show
  1. models/tts/base/tts_inferece.py +12 -3
models/tts/base/tts_inferece.py CHANGED
@@ -172,9 +172,18 @@ class TTSInference(object):
172
  out_dir = os.path.join(self.args.output_dir, "single")
173
  os.makedirs(out_dir, exist_ok=True)
174
 
175
- pred_audio = self.inference_for_single_utterance()
176
- save_path = os.path.join(out_dir, "test_pred.wav")
177
- save_audio(save_path, pred_audio, self.cfg.preprocess.sample_rate)
 
 
 
 
 
 
 
 
 
178
 
179
  elif self.infer_type == "batch":
180
  out_dir = os.path.join(self.args.output_dir, "batch")
 
172
  out_dir = os.path.join(self.args.output_dir, "single")
173
  os.makedirs(out_dir, exist_ok=True)
174
 
175
+ s1, s2, pred_audio = self.inference_for_single_utterance(length_scale = self.args.duration_control)
176
+ if s1 is not None and s2 is not None:
177
+ save_path_s1 = os.path.join(out_dir, "s1.wav")
178
+ save_path_s2 = os.path.join(out_dir, "s2.wav")
179
+ save_path_interpolated = os.path.join(out_dir, "test_pred.wav")
180
+ save_audio(save_path_s1, s1, self.cfg.preprocess.sample_rate)
181
+ save_audio(save_path_s2, s2, self.cfg.preprocess.sample_rate)
182
+ save_audio(save_path_interpolated, pred_audio, self.cfg.preprocess.sample_rate)
183
+ else:
184
+ save_path_s1 = os.path.join(out_dir, "test_pred.wav")
185
+ save_audio(save_path_s1, s1, self.cfg.preprocess.sample_rate)
186
+
187
 
188
  elif self.infer_type == "batch":
189
  out_dir = os.path.join(self.args.output_dir, "batch")