RealtimeTTS icon indicating copy to clipboard operation
RealtimeTTS copied to clipboard

Use different output_device_index with EdgeEngine

Open Nenesh opened this issue 10 months ago • 3 comments

I try to use "output_device_index=" like I use with CoquiEngine, but it seems that no matter which device I choose, it's always output on the system device (I can't send sound to my headphones if my default system sound is set to my speakers, which is possible with coqui).

Really short code I used to test.

from RealtimeTTS import TextToAudioStream, EdgeEngine

def dummy_generator():
    yield "This is a simple test of EdgeEngine."

if __name__ == '__main__':
    TextToAudioStream(
        EdgeEngine(
            rate=10, pitch=20), log_characters=True, output_device_index=18).feed(dummy_generator()).play() 

Nenesh avatar Feb 26 '25 23:02 Nenesh

Oh damn. That is probably a bug, EdgeEngine plays mp3 via mpv player. I think I missed to implement it there.

KoljaB avatar Feb 27 '25 08:02 KoljaB

Just check with 11labs engine and it's the same problem. Only play on default device. (Coqui, Azure, Kokoro work fine with output_device_index parameter). I just bypass the problem by changing the default output parameter of mpv directly on windows for the moment.

Nenesh avatar Feb 28 '25 21:02 Nenesh

Yes, ElevenlabsEngine and EdgeEngine are the two engines only producing mpeg chunks which can't be easily converted to wav in realtime, so they need to use mpv player. Just looked it up, mpv player does not seem to support simply setting the audio device index. So this needs some more serious rework.

KoljaB avatar Mar 01 '25 11:03 KoljaB