rushic24 commited on
Commit
dc95656
1 Parent(s): 027bef7

Update synthesize.py

Browse files
Files changed (1) hide show
  1. synthesize.py +1 -31
synthesize.py CHANGED
@@ -200,34 +200,4 @@ def synthesize(
200
 
201
  if audio_path:
202
  audio = vocoder.generate_audio(mel_outputs_postnet)
203
- write(audio_path, sample_rate, audio)
204
-
205
-
206
- if __name__ == "__main__":
207
- """Synthesize audio using model and vocoder"""
208
- parser = argparse.ArgumentParser(description="Synthesize audio using model and vocoder")
209
- parser.add_argument("-m", "--model_path", type=str, help="tacotron2 model path", required=True)
210
- parser.add_argument("-vm", "--vocoder_model_path", type=str, help="vocoder model path", required=True)
211
- parser.add_argument("-hc", "--hifigan_config_path", type=str, help="hifigan_config path", required=True)
212
- parser.add_argument("-t", "--text", type=str, help="text to synthesize", required=True)
213
- parser.add_argument("-g", "--graph_output_path", type=str, help="path to save alignment graph to", required=False)
214
- parser.add_argument("-a", "--audio_output_path", type=str, help="path to save output audio to", required=False)
215
- parser.add_argument("--silence_padding", type=float, help="Padding between sentences in seconds", default=0.15)
216
- parser.add_argument("--sample_rate", type=int, help="Audio sample rate", default=22050)
217
- args = parser.parse_args()
218
-
219
- assert os.path.isfile(args.model_path), "Model not found"
220
- assert os.path.isfile(args.vocoder_model_path), "vocoder model not found"
221
-
222
- model = load_model(args.model_path)
223
- vocoder = Hifigan(args.vocoder_model_path, args.hifigan_config_path)
224
-
225
- synthesize(
226
- model=model,
227
- text=args.text,
228
- graph_path=args.graph_output_path,
229
- audio_path=args.audio_output_path,
230
- vocoder=vocoder,
231
- silence_padding=args.silence_padding,
232
- sample_rate=args.sample_rate,
233
- )
 
200
 
201
  if audio_path:
202
  audio = vocoder.generate_audio(mel_outputs_postnet)
203
+ write(audio_path, sample_rate, audio)