20

I've read and experienced that music (mp3 etc) through the audio-jacket is poorly (popping sounds in between songs). Is this already solved or what's the best way (setting) to decrease this problem?

qwyrp
  • 201
  • 1
  • 2
  • 3
  • try the new experimental audio firmware: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=136445 –  Jun 01 '16 at 20:35
  • setting audio_pwm_mode=2 in /boot/config.txt fixes things for me in recent distros (2016-) – smarques Mar 12 '17 at 14:06

6 Answers6

12

This is a known problem that you can read about here and see the bug report here.

It appears to be an issue with the Broadcom VideoCore firmware, and the popping is caused by voltage jumps as the audio is enabled and disabled.

There is no current solution to the problem, however you can mitigate it's effect by playing audio continuously, instead of having a gap between songs. A script to do this is provided by ski522 in the same forum thread I posted before.

Create a shell script:

sudo nano mpgapless.sh

Then enter the following into the shell script.

#!/bin/bash
# mpgapless

case "$@" in
   *.m3u) PL="-playlist"
   ;;
esac
rm /tmp/audiofifo
mkfifo /tmp/audiofifo
aplay -t raw -c 2 -f S16_LE -r 48000 /tmp/audiofifo &> \
/tmp/aplayfifo.log & mplayer -noconfig all -nolirc -nojoystick \
-novideo -benchmark -vc null -vo null -ao pcm:fast -af resample=48000 -nocache \
-ao pcm:nowaveheader:file=/tmp/audiofifo $PL "$@"

Make the file executable:

chmod 555 ./mpgapless.sh

If you have a directory of music files you can use it like:

./mpgapless.sh *

All credit for this script to ski522.

Jivings
  • 22,538
  • 11
  • 90
  • 139
5

I gave up on the integrated audio jack and am glad that I did. I bought the following USB audio interface for a few dollars:

http://www.amazon.com/dp/B001MSS6CS/ref=pe_175190_21431760_3p_M3T1_ST1_dp_1

This way, the Pi does something it's good at (emitting digital data) and leaves the D/A conversion to the interface. It sounds great. Here's how I got it to work:

  1. edit /etc/modprobe.d/alsa-base.conf

  2. comment out the following line in /etc/modprobe.d/alsa-base.conf (uncommented, I think it gives the USB sound card minimum priority to become the default sound device) options snd-usb-audio index=-2

ref: http://forums.linuxmint.com/viewtopic.php?f=48&t=95337

The only downside is the added bulk of a dongle and that you lose an USB port.

Ghanima
  • 15,855
  • 15
  • 61
  • 119
seanmac7577
  • 71
  • 1
  • 3
3

The issue with the popping has now been fixed, but you need to upgrade your Raspberry Pi's firmware to take advantage of the fix. I had this issue with a brand-new Pi running Linux raspberrypi 3.6.11+ #399 (2013-02-09-wheezy-raspbian). As cited above, this is the history of the audio popping sound issue:

This is the web site I used to find out how to update my Pi's firmware:

For those not familiar with the "&&" syntax in Bash, these are the specific commands you can use to update your Pi (note the sudo prefix to ensure that commands are run with root privileges).

Update to the latest version of the Raspbian OS:

sudo apt-get update
sudo apt-get upgrade

Install the git version control system:

sudo apt-get install git

Install Hexxeh's rpi-update firmware update script:

sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update
sudo sudo chmod +x /usr/bin/rpi-update

Run the firmware update process, then reboot:

sudo rpi-update
sudo shutdown -r now

After that, my Pi no longer clicks before and after playing an audio file. After rebooting and logging in again, try it on your Pi with the following command:

omxplayer /usr/share/scratch/Media/Sounds/Vocals/Hey-yay-hey.mp3 
Steve HHH
  • 153
  • 5
1

It looks like you can use pulse audio and then disable the sleep between no activity in the audio. ( disable a line in /etc/pulse/default.pa). It should fix the audio popping issue.

Peterdk
  • 111
  • 3
0

Check this solution. Need to use good power supply which can filter out static current and provide clean audio on analog aux port.

http://www.howtoeverything.net/linux/raspberry-pi/sound-distortions-and-raspberry-pi-reasons-and-solutions

Mahen
  • 101
  • 1
0

Apart from solving these problems you mention. The audio out of the Pi is pretty poor in general.

I think it is best to use either a USB sound card, or a GPIO header sound card like one of these. The reason is that the audio codecs which they use are far more linear then a pulse width modulation (PWM) strategy which the Pi uses. This linearity implies much better sound quality.

Matt
  • 966
  • 6
  • 10