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.
Audio popping; OpenELEC, XBMC, or Pi problem?
31 posts
Page 1 of 2 1, 2
- Posts: 2
- Joined: Fri Oct 19, 2012 1:00 pm
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...
- Moderator
- Posts: 3322
- Joined: Wed Aug 17, 2011 7:41 pm
- Location: Cambridge
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...
Thanks for the fast reply, good to know it's 'known about'.
- Posts: 2
- Joined: Fri Oct 19, 2012 1:00 pm
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...
Well hopefully it's in the top 50 list
Are there any official bug links to track this?
- Posts: 373
- Joined: Sun Sep 30, 2012 2:22 pm
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.
- Posts: 1
- Joined: Fri Oct 19, 2012 8:57 pm
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
create a shell script:
- Code: Select all
sudo nano mpgapless.sh
Then enter the following into the shell script.
- 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 "$@"
Change the mode to executable.
- Code: Select all
chmod 555 ./mpgapless.sh
If you have a directory of music files you can use it like:
- Code: Select all
./mpgapless.sh *
To learn more about doing something like this just google "mplayer gapless playback"
- Posts: 373
- Joined: Sun Sep 30, 2012 2:22 pm
Same problem here. Using USB audio will fix the problem for now? Thanks
- Posts: 3
- Joined: Mon Nov 26, 2012 10:00 pm
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 ?
- Posts: 13
- Joined: Mon Jan 30, 2012 2:42 am
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.
- Posts: 373
- Joined: Sun Sep 30, 2012 2:22 pm
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.
- Posts: 28
- Joined: Mon Jul 09, 2012 10:42 am
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.
- Posts: 12
- Joined: Tue Nov 06, 2012 6:53 am
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
- Posts: 373
- Joined: Sun Sep 30, 2012 2:22 pm
Is there any other solution without pulse audio?
- Posts: 24
- Joined: Mon Nov 12, 2012 2:17 am
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?
- Posts: 24
- Joined: Mon Nov 12, 2012 2:17 am
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.
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
- Posts: 13
- Joined: Fri Dec 28, 2012 4:06 pm
pitt wrote:Has there been any solution to the problem by now?
@dom: How is your list going on? Can I help?
Cheers
Pitt
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.
- Posts: 373
- Joined: Sun Sep 30, 2012 2:22 pm
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 "$@"
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
- Posts: 13
- Joined: Fri Dec 28, 2012 4:06 pm
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
- Posts: 1
- Joined: Thu Jan 10, 2013 9:16 pm
I think, it's not a software problem. See this:
usb audio glitches when writing to SD card
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=13464&p=143082
and: Fixed latency issue...
https://github.com/raspberrypi/linux/pull/72#issuecomment-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/viewtopic.php?f=28&t=13464&p=143082
and: Fixed latency issue...
https://github.com/raspberrypi/linux/pull/72#issuecomment-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: 9
- Joined: Fri Jan 11, 2013 6:38 pm
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
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!
Cheers
- Posts: 1
- Joined: Mon Jan 14, 2013 7:49 pm
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.
- Posts: 1516
- Joined: Wed Jan 25, 2012 6:39 pm
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
- Posts: 13
- Joined: Fri Dec 28, 2012 4:06 pm
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?
- Posts: 16
- Joined: Tue Oct 09, 2012 2:54 pm
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
- Posts: 373
- Joined: Sun Sep 30, 2012 2:22 pm