If you have been experiencing audio skips or stuttering on a Raspberry Pi, then I may have a solution for you.
For background, I use an older Raspberry Pi as an audio player, using mpd as an audio server, MPD Remote on my Android Phone, and Sonata on my Xubuntu Laptop.
It was working fine for a long time, but then it started skipping audio every 10 or 20 seconds, regularly.
I tried all the solutions I found on the internet, most of them dating from 2012 or 2013. But the solutions that worked for me are:
Modify cmdline.txt
Before you try the next solution, it is worth trying out a simpler one instead. Just edit the file /boot/cmdline.txt and add the text nelow to the same line that is in there.
You must not put this on its own line, it has to be on the same line that is already there. You also have to but a space before the first sdhci... on the new part.
To do this, you can use the following command from a terminal:
sudo pico /boot/cmdline.txt
Press the End key on your keyboard, then the space key, then paste the following text:
sdhci-bcm2708.missing_status=0 sdhci-bcm2708.sync_after_dma=0
Hit Ctrl-X, then Y to save the file.
Reboot the Pi using this command:
sudo shutdown -r now
See if the stuttering is fixed.
Upgrade to the latest firmware
If the above does not help, then upgrade to the latest firmware using a simple command: rpi-update.
Here is the full output:
$ sudo rpi-update
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** Performing self-update
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13545 100 13545 0 0 39012 0 --:--:-- --:--:-- --:--:-- 39034
*** Relaunching after update
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** We're running for the first time
*** Backing up files (this will take a few minutes)
*** Backing up firmware
*** Backing up modules 4.14.79-v7+
################################################
This update bumps to rpi-4.14.y linux tree
Be aware there could be compatibility issues with some drivers
Discussion here:
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=197689
################################################
*** Downloading specific firmware revision (this will take a few minutes)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 168 0 168 0 0 421 0 --:--:-- --:--:-- --:--:-- 423
100 53.7M 100 53.7M 0 0 660k 0 0:01:23 0:01:23 --:--:-- 281k
*** Updating firmware
*** Updating kernel modules
*** depmod 4.14.93-v7+
*** depmod 4.14.93+
*** Updating VideoCore libraries
*** Using HardFP libraries
*** Updating SDK
*** Running ldconfig
*** Storing current firmware revision
*** Deleting downloaded files
*** Syncing changes to disk
*** If no errors appeared, your firmware was successfully updated to add510f7e85c18bf1a17cae9c5ec8dea20ccefc1
*** A reboot is needed to activate the new firmware
Follow this by this command:
sudo shutdown -r now
And when you are back, there will be no audio skipping!
Comments
Patrick Colestock (not verified)
Audio Skipping on RPi
Thu, 2019/10/24 - 11:19Just wanted to thank you for the tip on curing audio drop outs on the RPi. I had tried many different fixes in the last several months without success. While the 'update-rpi' could be considered a radical fix, it was just what was needed, and it worked beautifully. Thank you.
Michal (not verified)
Hi Khalid Baheyeldin, your
Sun, 2020/10/25 - 14:56Hi Khalid Baheyeldin, your guide has helped me. Thank you
Michal (not verified)
re Modiification for RPi 4
Sun, 2020/10/25 - 15:06Hi, would you modify sdhci-bcm2708.missing_status=0 sdhci-bcm2708.sync_after_dma=0 for RPi 4 ?
Khalid
Don't understand ..
Sun, 2020/10/25 - 15:08I don't understand ...
Is this a question or a fact that you have found out?
Michal (not verified)
Hi Khalid, it is a question,
Sun, 2020/10/25 - 15:11Hi Khalid, it is a question, as after several minutes of using your original fix on RPi 4, audio started to stutter again.
Khalid
Not sure ...
Sun, 2020/10/25 - 15:16I am not sure, since I don't have an RPi 4. The testing with audio that I did was on a Pi 2B.
But I did found something that is strange, yet foolproof. If I tell the Pi to stream from an internet radio channel, then turn on the receiver which is connected to the Pi over HDMI, everything works well. No stuttering ...
If on the other hand, I power on the receiver first, then tell the Pi to stream afterwards, it will always stutter.
No idea why this is, but the workaround is simple: always start streaming on the Pi and then power on the receiver. Or power off the receiver then on again. Always works.
Michal (not verified)
Hi Khalid, i have external
Sun, 2020/10/25 - 15:22Hi Khalid, i have external USB card plugged in and then an old analogue amp so your fix does not work for me unfortunately. However I have replaced 2708 by 2711 in your fix and it seems to work for 10min so far. I hope it will persits :-).