unijoh commited on
Commit
58fd969
1 Parent(s): e469d0f

Update tts.py

Browse files
Files changed (1) hide show
  1. tts.py +4 -3
tts.py CHANGED
@@ -33,9 +33,10 @@ def synthesize_speech(text):
33
  # Decode the generated speech and save to an audio file
34
  waveform = speech.cpu().numpy().flatten()
35
  # Use torchaudio to save the waveform
36
- torchaudio.save("output.wav", torch.tensor(waveform).unsqueeze(0), 16000)
37
- logging.info("Audio file saved successfully.")
38
- return "output.wav"
 
39
  except Exception as e:
40
  logging.error(f"Error during speech synthesis: {e}")
41
  return None
 
33
  # Decode the generated speech and save to an audio file
34
  waveform = speech.cpu().numpy().flatten()
35
  # Use torchaudio to save the waveform
36
+ file_path = "output.wav"
37
+ torchaudio.save(file_path, torch.tensor(waveform).unsqueeze(0), 16000)
38
+ logging.info(f"Audio file saved successfully at {file_path}.")
39
+ return file_path
40
  except Exception as e:
41
  logging.error(f"Error during speech synthesis: {e}")
42
  return None