Hi, I have recently started setting up Rhasspy. light control is working, but like many others, I also want to play Audio. For that, I use gmediarenderer, a GStreamer plugin that adds a DLNA-renderer. As I do not need multiroom, synced audio, this seems by far the most simple, compatible, and stable solution.
Now the issue is, that aplay commands by rhasspy seem to error while gstreamer is outputting sound (easily testable by running gst-launch-1.0 audiotestsrc ! audioresample ! pulsesink
and then trying TTS in Rhasspy). But as Gstreamer has no issue playing multiple sources, I thought I’d simply direct audio from Rhasspy to Gstreamer. Alas, that is where it ended for me.
I tried several parameters for Local Command
and program /usr/bin/gst-launch-1.0
, like filesrc location=/dev/stdin ! decodebin ! pulsesink
but all of them gave a non-zero exit code error and none played any sound.
I’ll take both help about how to get Rhasspy to output sound to a local gstreamer, as well as an explanation why I shouldn’t do what I’m doing and do something else instead Almost all my Linux experience is on a server, audio output was never something I had to handle.
edit: I got it to not throw an error with this:
fdsrc fd=0 ! wavparse ! audioconvert ! autoaudiosink
Sadly, it also does not play the audio. I checked if it should work by doing cat StarWars3.wav | gst-launch-1.0 fdsrc fd=0 ! wavparse ! audioconvert ! autoaudiosink
which correctly plays.
edit2: I went low level and tried this with a downloaded recording. It also plays properly
inf = open("play-recording.wav", "rb")
data = inf.read()
inf.close()
subprocess.run(["gst-launch-1.0", "fdsrc", "fd=0", "!", "wavparse", "!", "audioconvert", "!", "autoaudiosink"], input=data)