Help With Trying to Use GStreamer to Play a Flac/Wav File #1247
bai-yi-bai
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am having some trouble with gst-launch.
I am trying to replace some x86 clients with ESP-Snapcast clients.
One problem is that I have a Marshall-branded speaker which powers off after a few minutes of no audio. On the x86 hardware, I solved this by writing a bash script which checked for audio output and if there was none, played some brown noise, which sounds like a low rumble. I ran it as a systemd service. keep_alive_audio. Now that I'm moving to ESP32's, I want to move this function to my Snapcast server; making it broadcast the brown noise. I plan to write a script to make RPC calls to check if there's output, and when there is none, switch the client connected to the Marshall speaker to the tcp stream, play a wav file of the brown noise, and then switch back to the Spotify stream.
Using sox, I was able to create a wav and a flac file:
sox -n -r 48k -b 24 wakeup24.flac synth 3 whitenoise band -n 100 20 band -n 50 20 gain +2
sox -n -r 48k -b 24 wakeup.wav synth 3 whitenoise band -n 100 20 band -n 50 20 gain +2
I'm new to gstreamer and I only figured out how to playback the wakeup.wav file on the snapclient pc.
gst-launch-1.0 filesrc location=wakeup.wav ! wavparse ! audioconvert ! alsasink
My snapserver.conf
I tried many different combinations of parameters, but it is always distorted in one way or another.
gst-launch-1.0 filesrc location=wakeup.wav ! wavparse ! audioconvert ! audioresample ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! tcpclientsink host=127.0.0.1 port=4953
I tried approaching this more logically... I have a wav, which might not be a PCM, but my snapcast server is set up for 48 KHz, 24 bit and uses flac, so shouldn't I re-encode to flac?
gst-launch-1.0 filesrc location=wakeup.wav ! wavparse ! flacenc ! tcpclientsink host=127.0.0.1 port=4953
Beta Was this translation helpful? Give feedback.
All reactions