AsterNighT / tts-voice

Redirect tts to audio input
MIT License
3 stars 0 forks source link

How do I change the voice? #1

Open TwangyMoney opened 8 months ago

TwangyMoney commented 8 months ago

So I tried changing the TTS voice that is being used. From the TTSConfiguration and it seems to have broken. Do I need to change anything else? image image

I changed it from zh-CN-XiaoyiNeural to en-GB-RyanNeural and it gave me this:

Text: Hello?
Exception in thread Thread-3:
Traceback (most recent call last):
  File "C:\Users\Twangy Money\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "I:\TTS VOICE\tts-voice-master\main.py", line 38, in run
    asyncio.run(play(self.text))
  File "C:\Users\Twangy Money\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\Twangy Money\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Twangy Money\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "I:\TTS VOICE\tts-voice-master\main.py", line 29, in play
    streamer.play("tmp/"+name+".wav")
  File "I:\TTS VOICE\tts-voice-master\stream.py", line 13, in play
    sd.play(data, fs)
  File "C:\Users\Twangy Money\AppData\Local\Programs\Python\Python311\Lib\site-packages\sounddevice.py", line 175, in play
    ctx.start_stream(OutputStream, samplerate, ctx.output_channels,
  File "C:\Users\Twangy Money\AppData\Local\Programs\Python\Python311\Lib\site-packages\sounddevice.py", line 2582, in start_stream
    self.stream = StreamClass(samplerate=samplerate,
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Twangy Money\AppData\Local\Programs\Python\Python311\Lib\site-packages\sounddevice.py", line 1494, in __init__
    _StreamBase.__init__(self, kind='output', wrap_callback='array',
  File "C:\Users\Twangy Money\AppData\Local\Programs\Python\Python311\Lib\site-packages\sounddevice.py", line 898, in __init__
    _check(_lib.Pa_OpenStream(self._ptr, iparameters, oparameters,
  File "C:\Users\Twangy Money\AppData\Local\Programs\Python\Python311\Lib\site-packages\sounddevice.py", line 2747, in _check
    raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Error opening OutputStream: Invalid number of channels [PaErrorCode -9998]
AsterNighT commented 8 months ago

I test the voice you used and it works. This seems to be related to devices…… Could you please provide some more information? I would like to know that

  1. Does it run with the original voice? Or the error only triggers when you switch to an English tts?
  2. Which audio cable are you using? Or are you just testing with a normal audio output?