-
- Posts: 2
- Joined: Fri Oct 19, 2012 1:00 pm
Audio popping; OpenELEC, XBMC, or Pi problem?
I'm using OpenELEC on my Pi which is a minimal system to host XBMC. My intention is to use it solely as an audio player.
It runs pretty well, but I get a popping or clicking sound at the start or end of mp3 tracks.
I'm not sure if it's a Pi, XBMC, or OpenELEC issue.
In more detail, I am using the 3.5mm audio jack to output sound to an old hi-fi through its aux input. The sound quality is fine, it's just spoiled rather by the popping sound.
It runs pretty well, but I get a popping or clicking sound at the start or end of mp3 tracks.
I'm not sure if it's a Pi, XBMC, or OpenELEC issue.
In more detail, I am using the 3.5mm audio jack to output sound to an old hi-fi through its aux input. The sound quality is fine, it's just spoiled rather by the popping sound.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6351
- Joined: Wed Aug 17, 2011 7:41 pm
- Location: Cambridge
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
Pi problem. It doesn't affect HDMI, but it will affect analogue.
It's on my the list of things to do, but it's not trivial to fix, and my list is quite long...
It's on my the list of things to do, but it's not trivial to fix, and my list is quite long...
-
- Posts: 2
- Joined: Fri Oct 19, 2012 1:00 pm
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
Thanks for the fast reply, good to know it's 'known about'.dom wrote:Pi problem. It doesn't affect HDMI, but it will affect analogue.
It's on my the list of things to do, but it's not trivial to fix, and my list is quite long...
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
Well hopefully it's in the top 50 listdom wrote:Pi problem. It doesn't affect HDMI, but it will affect analogue.
It's on my the list of things to do, but it's not trivial to fix, and my list is quite long...

Are there any official bug links to track this?
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
My first RPI project is a motion triggered spooky sound player for Halloween. I suppose even with the audio noise before and after each sound I can scare some kids out of their costumes
...but it is not ideal.

Re: Audio popping; OpenELEC, XBMC, or Pi problem?
You can try gapless playback which will get rid of the popping...its a kludge but works for me.
Install mplayer:
create a shell script:
Then enter the following into the shell script.
Change the mode to executable.
If you have a directory of music files you can use it like:
To learn more about doing something like this just google "mplayer gapless playback"
Install mplayer:
Code: Select all
sudo apt-get install mplayer
Code: Select all
sudo nano mpgapless.sh
Code: Select all
#!/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 "$@"
Code: Select all
chmod 555 ./mpgapless.sh
Code: Select all
./mpgapless.sh *
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
Same problem here. Using USB audio will fix the problem for now? Thanks
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
Sorry for my ignorance but do you mean playing songs off a usb stick or playing audio out through the USB Port? If so what converter did you use to get it back in to analogue for the HiFi ?
Thanks.
Is there nay down side to installing Mplayer ?
Thanks.
Is there nay down side to installing Mplayer ?
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
Only way to solve the problem is to get an external USB sound card. There are issues with the PI's sound driver interfacing with the PI's analog sound port.
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
Popping is audible when the sound driver starts or stops. The solution is simple: Do not allow the audio driver to stop, ever. It should simply continue to play "silence" when nothing else is playing.
The solution presented by ski522 is similar but ties you to use mplayer.
Another solution is to use the pulseaudio audio server. I believe the raspbian image uses pulseaudio by default, so the necessary changes are minimal.
Pulseaudio with default settings is just trying to be nice and releases the sound card when no audio is playing. You can change that behaviour by having pulseaudio not load the module "module-suspend-on-idle". To achieve this, delete the corresponding line from /etc/pulse/default.pa and /etc/pulse/system.pa. You have to restart pulseaudio for the setting to take effect. Simplest method is to reboot the pi.
Now enjoy your music without pops and crackles.
The solution presented by ski522 is similar but ties you to use mplayer.
Another solution is to use the pulseaudio audio server. I believe the raspbian image uses pulseaudio by default, so the necessary changes are minimal.
Pulseaudio with default settings is just trying to be nice and releases the sound card when no audio is playing. You can change that behaviour by having pulseaudio not load the module "module-suspend-on-idle". To achieve this, delete the corresponding line from /etc/pulse/default.pa and /etc/pulse/system.pa. You have to restart pulseaudio for the setting to take effect. Simplest method is to reboot the pi.
Now enjoy your music without pops and crackles.
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
Hmm I tried that. Edited both files and rebooted.
I commented out
load-module module-suspend-on-idle
and then deleted the line altogether. It didn't work for me. Still pops.
I commented out
load-module module-suspend-on-idle
and then deleted the line altogether. It didn't work for me. Still pops.
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
I don't believe any of the XBMC pi builds support pulse audio. You have to run a version of XBMC that has been built to use pulse audio. http://forum.stmlabs.com/showthread.php?tid=1052
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
Is there any other solution without pulse audio?
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
I have compiled XBMC with pulse audio, but it didn't help for me.
I found this article: http://elinux.org/RPi_Bugs
Isn't it hardware problem? Or hadware problem is only about distortion?
I found this article: http://elinux.org/RPi_Bugs
Isn't it hardware problem? Or hadware problem is only about distortion?
- mahjongg
- Forum Moderator
- Posts: 14785
- Joined: Sun Mar 11, 2012 12:19 am
- Location: South Holland, The Netherlands
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
That problem is a very minor one, and only comes about when playing very loud sound, where clipping (distortion) would occur anyway.
It has nothing to to with the plopping sound that occurs when the PWM machine is turned on.
before it is turned on the sound output is at 0,0V level, but turning it on makes the level rise almost instantly to 2,5V, this causes the loud plopping noise.
It has nothing to to with the plopping sound that occurs when the PWM machine is turned on.
before it is turned on the sound output is at 0,0V level, but turning it on makes the level rise almost instantly to 2,5V, this causes the loud plopping noise.
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
Hi everybody,
mahjongg pointed me to this thread, which treats the topic some people are dicussing in the german language forum right now.
I am planning to give a linux class in a school and have the kids build a webradio with mpg123 and some self-programmed shellscripts. Unfortunately the popping sound at each startup and stop of mpg123 will piss them off.
Has there been any solution to the problem by now?
@dom: How is your list going on? Can I help?
Cheers
Pitt
mahjongg pointed me to this thread, which treats the topic some people are dicussing in the german language forum right now.
I am planning to give a linux class in a school and have the kids build a webradio with mpg123 and some self-programmed shellscripts. Unfortunately the popping sound at each startup and stop of mpg123 will piss them off.
Has there been any solution to the problem by now?
@dom: How is your list going on? Can I help?
Cheers
Pitt
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
The issue is with correcting the sound driver and why this hasn't been resolved by now is odd considering the problem has been around for some time. Otherwise I would suggest some cheap USB sound adapters. I picked one up for $2 that worked great and eliminated the popping noise.pitt wrote: Has there been any solution to the problem by now?
@dom: How is your list going on? Can I help?
Cheers
Pitt
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
Hi,
I tried lanmacs solution with the december-image of Raspbian wheezy and mpg123. It works if I start mpg123 with the option '-o pulse'. I wrote myself a script /usr/bin/mpg123-pa with content
which I use from now on.
Disadvantages: The pulseaudio server uses continouosly 1-2% of cpu power, The device is blocked and the Raspi consumes more power.
Nevertheless, this works for me, though a real fix of the problem would be great.
Many thanks to everybody in the forum.
Pitt
I tried lanmacs solution with the december-image of Raspbian wheezy and mpg123. It works if I start mpg123 with the option '-o pulse'. I wrote myself a script /usr/bin/mpg123-pa with content
Code: Select all
#!/bin/sh
exec /usr/bin/mpg123.bin -o pulse "$@"
Disadvantages: The pulseaudio server uses continouosly 1-2% of cpu power, The device is blocked and the Raspi consumes more power.
Nevertheless, this works for me, though a real fix of the problem would be great.
Many thanks to everybody in the forum.
Pitt
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
I came up with a quick and dirty hack that solves this problem for me with XBMC: http://www.oxymoronical.com/blog/2013/0 ... nning-XBMC
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
I think, it's not a software problem. See this:
usb audio glitches when writing to SD card
http://www.raspberrypi.org/phpBB3/viewt ... 4&p=143082
and: Fixed latency issue...
https://github.com/raspberrypi/linux/pu ... nt-7437129
For me, the effect did not bring.
I have the same problem with M2Tech HiFace Two. Only solution for me, is move /root directory to pendrive (without /boot) and use SD cart only for booting. I did it and after 2-3 hours I can test it. Keep your fingers crossed!
usb audio glitches when writing to SD card
http://www.raspberrypi.org/phpBB3/viewt ... 4&p=143082
and: Fixed latency issue...
https://github.com/raspberrypi/linux/pu ... nt-7437129
For me, the effect did not bring.
I have the same problem with M2Tech HiFace Two. Only solution for me, is move /root directory to pendrive (without /boot) and use SD cart only for booting. I did it and after 2-3 hours I can test it. Keep your fingers crossed!
-
- Posts: 1
- Joined: Mon Jan 14, 2013 7:49 pm
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
Hey Mossop, I tried your guide but the problem in raspbmc still prevails. Ismod tells me that snd_bcm2835 is loaded. I edited out "load-module module-suspend-on-idle" with a # in system.pa (and default.pa). I edited .bashrc with the test sound and when I ssh in I can hear the test .wav being played, and there don't seem to be any more pops with paplay. At first in xbmc there was no more sound at all but adding "sudo amixer cset numid=3 1" to .bashrc fixed that, however the pops prevail. I am running Release Candidate 5, Built: 20121231 - fresh install. Do I have to change anything within Raspbmc Settings Addon, i.e. enable the Audio Engine? Would be great to get rid of these popping sounds!Mossop wrote:I came up with a quick and dirty hack that solves this problem for me with XBMC: http://www.oxymoronical.com/blog/2013/0 ... nning-XBMC
Cheers
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
The reason given by mahjongg in his post of 31 December is 100% correct. There are two possibilities to eliminate the pop:
1. Keep the "1-bit DAC" subsystem running all the time so that the 0 to 2.5 volt transition and the reverse don't occur.
2. Modify the "1-bit DAC" software so that when it is brought into use the digital input to the Pulse Modulator gubbins initially corresponds to 0 volts (peak negative audio amplitude) and it is slowly changed to the digital value corresponding to zero audio signal (ie 2.5 volts) before the actual digital audio signal is played. I don't have a good feel for precisely how slowly this needs to be done but I think it can be quick enough not to incur annoying delay before audio output is heard.
1. Keep the "1-bit DAC" subsystem running all the time so that the 0 to 2.5 volt transition and the reverse don't occur.
2. Modify the "1-bit DAC" software so that when it is brought into use the digital input to the Pulse Modulator gubbins initially corresponds to 0 volts (peak negative audio amplitude) and it is slowly changed to the digital value corresponding to zero audio signal (ie 2.5 volts) before the actual digital audio signal is played. I don't have a good feel for precisely how slowly this needs to be done but I think it can be quick enough not to incur annoying delay before audio output is heard.
Quis custodiet ipsos custodes?
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
Hi Folks,
I agree. Solution 2 would be perfectly ok.
I tried to cope with the pulseaudio solution for some weeks now. It works, but the truth is, introducing an additional server (pulseaudio) introduces additional problems (besides the ALSA ones).
The best solution would thus be to fix the driver as drgeoff suggested. Does anybody know where this piece of software (1-bit-DAC) lives?
Pitt
I agree. Solution 2 would be perfectly ok.
I tried to cope with the pulseaudio solution for some weeks now. It works, but the truth is, introducing an additional server (pulseaudio) introduces additional problems (besides the ALSA ones).
The best solution would thus be to fix the driver as drgeoff suggested. Does anybody know where this piece of software (1-bit-DAC) lives?
Pitt
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
Bummer, I was planning on using the raspi as a media player (mpd or squeezebox) and this problem is definitely apparent!
I am running archlinux for ARM, I will see if I can implement one of the fixes provided, I do not want to add an external sound card, as I don't have room for it in my build...
Any other software fixes?
I am running archlinux for ARM, I will see if I can implement one of the fixes provided, I do not want to add an external sound card, as I don't have room for it in my build...
Any other software fixes?
Re: Audio popping; OpenELEC, XBMC, or Pi problem?
For $14, it's well work getting this card for music, the quality is excellent and many have used it with the Pi including myself. Sure it adds a extra component, but if you're looking for a decent music out of the Pi, this is the route to take for short dollars!
http://www.aliexpress.com/store/product ... o_detail_a
or via ebay
http://www.ebay.com/itm/PCM2704-USB-DAC ... 2ec525964c

http://www.aliexpress.com/store/product ... o_detail_a
or via ebay
http://www.ebay.com/itm/PCM2704-USB-DAC ... 2ec525964c