let the user define outpu.wav file path fix #393

This commit is contained in:
Eren Gölge 2021-03-30 14:24:05 +02:00
parent 25654233d5
commit d0dcd7d1b8
1 changed files with 4 additions and 8 deletions

View File

@ -103,8 +103,8 @@ def main():
parser.add_argument( parser.add_argument(
'--out_path', '--out_path',
type=str, type=str,
default=Path(__file__).resolve().parent, default='tts_output.wav',
help='Path to save final wav file. Wav file will be named as the given text.', help='Output wav file path.',
) )
parser.add_argument( parser.add_argument(
'--use_cuda', '--use_cuda',
@ -218,12 +218,8 @@ def main():
wav = synthesizer.tts(args.text) wav = synthesizer.tts(args.text)
# save the results # save the results
file_name = args.text.replace(" ", "_")[0:20] print(" > Saving output to {}".format(args.out_path))
file_name = file_name.translate( synthesizer.save_wav(wav, args.out_path)
str.maketrans('', '', string.punctuation.replace('_', ''))) + '.wav'
out_path = os.path.join(args.out_path, file_name)
print(" > Saving output to {}".format(out_path))
synthesizer.save_wav(wav, out_path,)
if __name__ == "__main__": if __name__ == "__main__":