Use different output_device_index with EdgeEngine
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()
Oh damn. That is probably a bug, EdgeEngine plays mp3 via mpv player. I think I missed to implement it there.
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.
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.