KoljaB / RealtimeTTS

Converts text to speech in realtime

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"tests/write_to_file.py" does not seem producing any wav files

scubadriver opened this issue · comments

Example "tests/write_to_file.py" not producing any files.
I've tried for SystemEngine() and for CoquiEngine()
Used file name, relative and full file name.
Same result as .play():
.play(file_name) outputs to speakers and no "system_output.wav" anywhere on C:\ drive

  stream.load_engine(system_engine)
  stream.feed(dummy_generator())
  # works as a .play() without parameters->output to speakers
  stream.play(output_wavfile=stream.engine.engine_name + "_output.wav") 

in my case it looks like:

def speakSys():
  text_gen   = dummy_generator()
  sys_engine = SystemEngine()
  stream = TextToAudioStream(sys_engine)
  
  stream.feed(text_gen)

  # last attempt to put it into the working folder since just file name or ".\\" did not work  
  output_wavfile = "C:\\dev_free\\w1\\" + stream.engine.engine_name + "_output.wav" 
 
  print (f"Writing to {output_wavfile} ...")
  stream.play(output_wavfile)

Ok, let's do the simplest possible test.

from RealtimeTTS import TextToAudioStream, SystemEngine

system_engine = SystemEngine()

stream = TextToAudioStream(system_engine)
stream.feed("This is a test")
stream.play(output_wavfile=stream.engine.engine_name + "_output.wav")

This should write a file "system_output.wav" in the execution folder of the python script. Works on my system - does this fail on yours?

Sorry for time diff. I am in Boston.
Yours worked!

I investigated a bit. Modified yours to show what seems to be my problem:

#stream.play(output_wavfile=stream.engine.engine_name + "_output2.wav")
stream.play(out_wavfile=stream.engine.engine_name + "_output.wav")

Traceback:

PS C:\dev_free\w1> & c:/dev_free/w1/.venv/Scripts/python.exe c:/dev_free/w1/nik.py
Traceback (most recent call last):
  File "c:\dev_free\w1\nik.py", line 7, in <module>
    stream.play(out_wavfile=stream.engine.engine_name + "_output.wav")
TypeError: TextToAudioStream.play() got an unexpected keyword argument 'out_wavfile'

F!*&-( Sorry, "output_wavfile" is a default parameter, not a string variable (I am a C guy) :-(
Closing...