Hello y'all,
I use a Pi Zero as a wifi-radio-device. (dietpi V6 + mpg123 + textfile with radio-stream-url's). I am tinkering with it to get a smooth radio-output but usually the radio-stream will stop/continue (at some point/time) or just stop. I have the processor governor on performance. Swapfile auto. I even niced mpg123 but still the audio stream is interrupted from time to time. (sometimes mpg123 will also lose the alsa-device)
Parameters (tested) for mpg123: --smooth --no-gapless -T --aggressive
Any tips ?
ps: below the script i use to change to a diffent radio-url-stream
#!/bin/bash
#Stop the radio if it is running
pidof mpg123 >/dev/null
if [ $? -eq 0 ] ;
then
killall mpg123
sleep 2
fi
#Get the next radio-stream-url (just the line number, textfile contains 7 stream-url's)
var="$(cat /root/count.txt)"
if [ $var -eq 7 ];
then
var2=1
else
var2=$((var + 1))
fi
#get the next stream-url
VARI="$(sed -n "$var2"p < /root/radiolijst.txt)"
#play the url
/usr/bin/mpg123 --smooth --no-gapless $VARI &
#store the line number that is being played
echo $var2 > /root/count.txt
(Diet) Pi zero / radio
Re: (Diet) Pi zero / radio
Hi,
Try using killall (wait), waits for process to finish before continuing, sleep section no longer required after it:
Will increase latency, but should reduce issues.
If problems persist, try reducing the audio sample rate (-2).
Failing that, you could try a realtime kernel, but if the issue is consistently occurring, even that may not be enough. Faster CPU then required.
Try using killall (wait), waits for process to finish before continuing, sleep section no longer required after it:
Code: Select all
killall -w mpg123
Most likely due to underbuffer. Check dmesg for more info.but still the audio stream is interrupted from time to time. (sometimes mpg123 will also lose the alsa-device)
Try increasing audio buffer size:
Code: Select all
/usr/bin/mpg123 -b 4096 --smooth --no-gapless -T --aggressive
If problems persist, try reducing the audio sample rate (-2).
Failing that, you could try a realtime kernel, but if the issue is consistently occurring, even that may not be enough. Faster CPU then required.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Re: (Diet) Pi zero / radio
Thnx Fourdee! 
And, yep, far more stable now (no interruptions detected so far)

And, yep, far more stable now (no interruptions detected so far)