User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 9663
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

STICKY: Analog audio problems? post comments here!

Sat Jan 03, 2015 7:54 pm

I have no experience with analog audio on the Pi, but I often see questions about it.
Perhaps we can use this thread as a Q&A?

Question: what is needed to get analog audio working?

Answer: I think you need to change audio mixer settings, is that it? Unfortunately I have little experience with the subject, but hopefully the answers here can one day be compiled into a Q&A.

if you have audio problems, please start here.

Please make sure that you read the thread before asking a question! Duplicates will be removed to keep the thread short enough to be manageable.

amith
Posts: 7
Joined: Tue Dec 02, 2014 7:35 pm

Re: Analog audio problems? post comments here!

Wed Jan 07, 2015 1:39 pm

There are many posts talking about the ‘clicks’ caused when using the audio jack
I couldn’t find if and how the Alsa API can be used (without using intermediate utilities) to play sound without getting the clicks
I hear ‘clicks’ between two calls to snd_pcm_writei , which are separated in time (if I call it in a for loop no ‘cliks’, but if I execute other code parts and then call the function again, I hear the click)
Any known solution that will enable me to use the Alsa API?

jcfromnj
Posts: 1
Joined: Wed Jan 07, 2015 8:59 pm

Re: Analog audio problems? post comments here!

Wed Jan 07, 2015 9:21 pm

Does the Wolfson Audio card work with the B+? Don't see any instructions on how to mount the card. The pin configuration on the B+ has more pin's than the previous models, and the contacts on the previous model with the Card installed are different. Any thoughts on this ?

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 9663
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Analog audio problems? post comments here!

Fri Jan 09, 2015 12:57 am

jcfromnj wrote:Does the Wolfson Audio card work with the B+? Don't see any instructions on how to mount the card. The pin configuration on the B+ has more pin's than the previous models, and the contacts on the previous model with the Card installed are different. Any thoughts on this ?
No it doesn't work, a new B+ version was promised.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 9663
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Analog audio problems? post comments here!

Fri Jan 09, 2015 1:00 am

amith wrote:There are many posts talking about the ‘clicks’ caused when using the audio jack
I couldn’t find if and how the Alsa API can be used (without using intermediate utilities) to play sound without getting the clicks
I hear ‘clicks’ between two calls to snd_pcm_writei , which are separated in time (if I call it in a for loop no ‘cliks’, but if I execute other code parts and then call the function again, I hear the click)
Any known solution that will enable me to use the Alsa API?
The clicks were a result of tuning on and off the PWM engine (when off the output voltage goes to 0V, when on it goes to "mid rail" with full rail (maximum positive output) being 1V, and mid rail being 0.5V, so the AC can swing 0.5V positive or negative) . The solution (known for a long time now) was to never turn the PWM engine off, (keeping it at 0.5V) or to use a "soft turn on" algorithm (very slowly ramping the PWM engine from 0V to 0.5V).

These solution(s) were incorporated in the distro's for a long time now. Clicks should be "old and forgotten".

amith
Posts: 7
Joined: Tue Dec 02, 2014 7:35 pm

Re: Analog audio problems? post comments here!

Fri Jan 09, 2015 8:06 am

Do I need to do anything beside:
sudo apt-get update
and
sudo apt-get upgrade

Any other reason for the clicks?

User avatar
DougieLawson
Posts: 30448
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Analog audio problems? post comments here!

Fri Jan 09, 2015 12:47 pm

amith wrote:Do I need to do anything beside:
sudo apt-get update
and
sudo apt-get upgrade

Any other reason for the clicks?
I'd use
sudo apt-get update && sudo apt-get dist-upgrade
as that will ensure you get a 3.12.35+ kernel and the latest firmware code on your system.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

wgeorge76
Posts: 2
Joined: Sun Feb 08, 2015 3:57 am

Re: Analog audio problems? post comments here!

Sun Feb 08, 2015 5:23 am

Hello,
I have followed the links on correcting audio issues, though I am still having problems trying to get sound out of the 3.5mm socket with my earphones. I have used raspi-config to force audio to the socket, which outputted the following when exiting...

numid=3,iface=MIXER,name='PCM Playback Route'
; type=INTEGER,access=rw------,values=1,min=0,max=2,step=0
: values=1

Have a USB CDROM plugged into a powered USB HUB.
I installed cdcd and ran commands

pi@raspberrypi ~ $ cdcd -d /dev/sr0 rndplay
pi@raspberrypi ~ $ cdcd -d /dev/sr0 info
Album name: Black Ice
Album artist: AC~DC
Total tracks: 15 Disc playing: 11:56 of 55:39
Playing: Anything Goes 04 00:02 of 03:22
pi@raspberrypi ~ $ cdcd -d /dev/sr0 stop
pi@raspberrypi ~ $ cdcd -d /dev/sr0 close

unfortunately there is not sound still.
So, I installed mplayer, and it works and can hear the music, though no info as cdcd above.

I'll get more info if needed.

Would really like to get the sound working on using cdcd.
Thank you

jfw57
Posts: 2
Joined: Wed Feb 11, 2015 11:54 pm

Raspberry Pi 2 Quake 3 Intermittent Audio

Thu Feb 12, 2015 12:33 am

Hello All,
I've been using the Pi since Summer, 2012, and have been able to solve most problems via Internet search and trial-and-error, however this one has me puzzled. Simply put, the new Raspberry Pi 2 Model B seems to have some analog audio problems when running sound in Quake 3. It is particularly noticeable about 10 seconds into the demo named four.dm_68, which comes with ioquake3.arm, when suddenly the sound starts becoming intermittent, and it continues throughout the demo. The intermittent audio is also noticeable, but less choppy, when playing a level, particularly when running or firing weapons.
I have the latest 2015-01-31 version of Raspbian Linux on a 16 GB Class 10 SD card, and have run update, dist-update, and rpi-update. ALSA is set up correctly and plays music and wave files flawlessly using aplay, mplayer and mpg321. The cut scenes in Quake 3 from the beginning of each tier have good sound. I get the same results whether playing through HDMI, the audio jack, or Bluetooth. I have tried another Raspberry Pi 2 board and have observed these same symptoms. Pulse audio is not present in my system. I did a fresh download and make on the Quake 3 files, and still the same results. One interesting note, I took the same SD card out of the Raspberry Pi 2 Model B and put it into a Raspberry Pi Model B+ (reusing the same cables, power supply and peripherals) and the sound is flawless. One more symptom: after one run of Quake 3 in the Raspberry Pi 2, there were a number of lines stating: ALSA lib pcm.c: 7339(snd_pcm_recover) underrun occurred.
I suspect that this is some kind of buffering error, that perhaps the sounds are being fed in to the quad-core processor faster than they can be handled, but I can't seem to find a definitive answer online as to how to fix this issue. Is a custom asound.conf needed, or possibly a change to the programming or make file of Quake 3 source code, or perhaps an adjustment to config.txt is in order? At the very least, can someone else with a Raspberry Pi 2 please run Quake 3 and confirm these symptoms? Thank you for your time, and I hope someone with a wee bit more experience can come up with a solution to this sound issue.
jackie

jfw57
Posts: 2
Joined: Wed Feb 11, 2015 11:54 pm

Re: Analog audio problems? post comments here!

Tue Feb 17, 2015 9:28 pm

Hello Again,
Well, after a bit of searching, it appears I solved my own problem with Quake 3 Arena sound on the Raspberry Pi 2 Model B. The problem of sound underruns is apparently caused by too much video action crowding out the sound, so the solution seems to be to cap the frame rate. This can be done by pressing ` (grave accent, usually under the tilde (~), not apostrophe) after Quake 3 Arena has been started to access the drop-down console. Then I typed \com_maxfps 40 at the command prompt to limit the frame rate to 40 frames per second. There are still a few sound drop-outs (underruns) at this frame rate, but it is only noticeable when the video action is very heavy. Press the ' (grave accent) again to dismiss the drop-down console and then play the game with better sound. This setting should be retained even after quitting and rebooting Quake 3 Arena or the entire system, until you reset it manually through the console as above. If you want to see the FPS (frames per second), the setting is \cg_drawfps 1 to turn it on, and \cg_drawfps 0 in the console to turn off the FPS display. Prior to setting this, the Raspberry Pi 2 was giving frame rates of 60 to 90, which is great for video, but the sound gaps were quite noticeable.
jackie

strongleg
Posts: 18
Joined: Mon Aug 25, 2014 7:03 am

Re: Analog audio problems? post comments here!

Fri Feb 27, 2015 9:22 am

it's nice to have a topic specific for analog audio problem.

here is the problem: my pi(B+) using the kernel from kernel.org, not the official raspberry pi version. and try to get analog audio working. but no matter how i try, I can't see any message during or after boot related to the soc's sound function. for example, this is the result of "aplay -l":
~$ sudo aplay -l
[sudo] password for xxx:
**** List of PLAYBACK Hardware Devices ****
card 0: Dummy [Dummy], device 0: Dummy PCM [Dummy PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7

I don't have the module snd_bcm2835(or snd-bcm2835?) too.
any idea to bring sound to this kernel?

strongleg
Posts: 18
Joined: Mon Aug 25, 2014 7:03 am

Re: Analog audio problems? post comments here!

Fri Feb 27, 2015 12:37 pm

things got a little interesting, I found 3 modules in rpi official kernel: vcio, vchiq, snd-bcm2835, which i have to compile and insmod to my kernel.org kernel.
but when i insmod vchiq.ko, it print:
[11275.668797] ERROR: 256 KiB atomic DMA coherent pool is too small!
[11275.668797] Please increase it with coherent_pool= kernel parameter!
[11275.668857] vchiq: Unable to allocate channel memory
[11275.669637] vchiq: could not load vchiq
any suggestion?
strongleg wrote:it's nice to have a topic specific for analog audio problem.

here is the problem: my pi(B+) using the kernel from kernel.org, not the official raspberry pi version. and try to get analog audio working. but no matter how i try, I can't see any message during or after boot related to the soc's sound function. for example, this is the result of "aplay -l":
~$ sudo aplay -l
[sudo] password for xxx:
**** List of PLAYBACK Hardware Devices ****
card 0: Dummy [Dummy], device 0: Dummy PCM [Dummy PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7

I don't have the module snd_bcm2835(or snd-bcm2835?) too.
any idea to bring sound to this kernel?

User avatar
ragnarjensen
Posts: 318
Joined: Wed May 15, 2013 6:13 pm
Location: Stockholm, Sweden
Contact: Website

Re: Analog audio problems? post comments here!

Sun Mar 01, 2015 1:52 am

In a standard Raspbian kernel, the size of the coherent pool is 4 MB.
You can change it by adding the kernel parameter coherent_pool=XM to the end of the single line in /boot/cmdline.txt.
Max value for X is 15.
--
Ragnar

strongleg
Posts: 18
Joined: Mon Aug 25, 2014 7:03 am

Re: Analog audio problems? post comments here!

Sun Mar 01, 2015 1:39 pm

yes, vcio and vchiq module can be insmod correctly after add this kernel parameter.

but 'aplay -l' still doesn't show the bcm2835 sound device. i add some print to bcm2835.c, find the function bcm2835_alsa_device_init() is called,
static int bcm2835_alsa_device_init(void)
{
platform_driver_register(&bcm2835_alsa0_driver);
platform_driver_register(&bcm2835_alsa1_driver);
//...repeat for 8 times
}
and the struct bcm2835_alsa0_driver, bcm2835_alsa1_driver look like:
static struct platform_driver bcm2835_alsa0_driver = {
.probe = snd_bcm2835_alsa_probe,
.remove = snd_bcm2835_alsa_remove,
//...
}

the snd_bcm2835_alsa_probe() in above struct is NOT called. i thinks that's why i don't get the sound device. so when or how does this snd_bcm2835_alsa_probe() being called?

thanks, and forgive me because i am not familiar with either device drive or alsa, not to say bcm2835 video core.
ragnarjensen wrote:In a standard Raspbian kernel, the size of the coherent pool is 4 MB.
You can change it by adding the kernel parameter coherent_pool=XM to the end of the single line in /boot/cmdline.txt.
Max value for X is 15.
--
Ragnar

mward
Posts: 2
Joined: Thu Mar 05, 2015 10:17 am

Re: Analog audio problems? post comments here!

Wed Mar 11, 2015 4:47 pm

I have a project where I need to record from several microphones
(perhaps up to eight). I can record from two at once when plugged
directly into the Raspberry Pi, but when they are plugged into
a USB hub the recordings are horribly distorted (missing sections
of data). I saw a comment on the Pi forum about adding
dwc_otg.speed=1 to /boot/cmdline.txt to switch the USB down to 1.1

This seems to work for two microphones, but with three or more
I get an error: "read/write error, state = PREPARED"
and the following message in /var/log/messages:
"Insufficient periodic bandwidth for periodic transfer"

It seems that USB 1.1 does not provide enough bandwidth for
more than two microphones at once.

I have seen references to a branch called fiq_split:

sudo BRANCH=fiq_split rpi-update

This branch does not seem to exist any more.
Has it been included in the current or next branch?
(These appear to be the only branches available)

Edit: I found that using a Plugable USB 2.0 7-Port powered hub, which also powers the Pi, I can record from at least four USB microphones at once (after removing the setting dwc_otg.speed=1 from /boot/cmdline.txt)
Last edited by mward on Wed Mar 11, 2015 7:22 pm, edited 1 time in total.

JamesLehman
Posts: 35
Joined: Mon Apr 15, 2013 12:10 am
Location: Akron, Ohio USA
Contact: Website

Re: Analog audio problems? post comments here!

Wed Mar 11, 2015 7:06 pm

Hello everyone.

I just got a Raspberry Pi 2 and installed Raspbian via NOOBS.

I have been keeping it updated daily with apt-get install update, upgrade and rpi-update.

My question is about HDMI 8 channel audio.

Maybe I just don't understand how it is supposed to work.

My goal is to be able to make 8 channel wave files and play them through the HDMI port into an audio extractor.

I got one of these:

http://www.atlona.com/HD570.html

Is it possible to use this device to get 8 channels of analog audio from the Pi2 by playing an 8 channel wave file?

The wave is loaded and recognized as 8 channel, 16 bit little endian by aplay, but I only get the first two channels out of this device.

Any ideas?

Thanks in advance.

edit:
I'm doing a lot of reading and it seems like the HDMI throughput needs to be connected to a device that reports that it can take Dolby 7.1. A regular LCD monitor with a DVI input converted from HDMI has no audio capability.

I tried it on my home theater system, which is an Onkyo AV receiver and it still doesn't work. As a matter of fact, that is where I got the stereo performance. I also have a PS-3 that I know puts out surround sound and passed that through this device and I still don't get anything out of the channels other than front L & R stereo.

When I try to play a standard stereo wave through this device into a no-audio monitor I get nothing from the audio extractor.

What do I do with this?

Is there any way to use the HDMI audio as a simple 8 channel audio device?

I can use the USB SND8 (CMedia 6206) just fine, but I am interested in the built in capabilities of the Pi2 and I also like the fact that I might be able to play waves at 96KHz or even 192KHz sample rates.

James.

PS. The Pi2 is amazing. Great job! :)

User avatar
aw3s0m3123
Posts: 3
Joined: Fri Mar 13, 2015 1:19 am

Re: Analog audio problems? post comments here!

Fri Mar 13, 2015 1:48 am

I was wondering, how can I change the volume on a B+ running raspbian?

User avatar
DougieLawson
Posts: 30448
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Analog audio problems? post comments here!

Fri Mar 13, 2015 8:46 am

aw3s0m3123 wrote:I was wondering, how can I change the volume on a B+ running raspbian?
alsamixer can do that.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

User avatar
aw3s0m3123
Posts: 3
Joined: Fri Mar 13, 2015 1:19 am

Re: Analog audio problems? post comments here!

Sat Mar 14, 2015 8:17 pm

DougieLawson wrote: alsamixer can do that.
By any chance does alsamixer have a GUI, or is it just accessable from the terminal and/or LXTerminal?

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 9663
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Analog audio problems? post comments here!

Sat Mar 14, 2015 8:20 pm

?Alsmixer is a command line program, but as such can have a GUI frontend.

which frontend you use depends on which desktop software you are running, popular frontends are aumix or gnome-alsamixer or kmix

User avatar
aw3s0m3123
Posts: 3
Joined: Fri Mar 13, 2015 1:19 am

Re: Analog audio problems? post comments here!

Sat Mar 14, 2015 8:33 pm

Thanks, I installed gnome-alsamixer and it works great. :)

Drobnjak
Posts: 1
Joined: Sun Mar 15, 2015 11:34 am

Re: Analog audio problems? post comments here!

Sun Mar 15, 2015 11:41 am

Hi, I'm new in Raspberry Pi and I have new 2 B model. I finally make it playing audio via network, but when I play it in hear in speakers buzzing or distortion. I heard the problem is from charger. I'm using Galaxy Note 2 charger is this a problem?? Thanks for help :)

SenorSensor
Posts: 10
Joined: Thu Mar 19, 2015 1:14 pm

Re: Analog audio problems? post comments here!

Sat Mar 21, 2015 2:21 pm

JamesLehman wrote:Hello everyone.

I just got a Raspberry Pi 2 and installed Raspbian via NOOBS.

I have been keeping it updated daily with apt-get install update, upgrade and rpi-update.

My question is about HDMI 8 channel audio.

Maybe I just don't understand how it is supposed to work.

My goal is to be able to make 8 channel wave files and play them through the HDMI port into an audio extractor.

I got one of these:

http://www.atlona.com/HD570.html

Is it possible to use this device to get 8 channels of analog audio from the Pi2 by playing an 8 channel wave file?

The wave is loaded and recognized as 8 channel, 16 bit little endian by aplay, but I only get the first two channels out of this device.

Any ideas?

Thanks in advance.

edit:
I'm doing a lot of reading and it seems like the HDMI throughput needs to be connected to a device that reports that it can take Dolby 7.1. A regular LCD monitor with a DVI input converted from HDMI has no audio capability.

I tried it on my home theater system, which is an Onkyo AV receiver and it still doesn't work. As a matter of fact, that is where I got the stereo performance. I also have a PS-3 that I know puts out surround sound and passed that through this device and I still don't get anything out of the channels other than front L & R stereo.

When I try to play a standard stereo wave through this device into a no-audio monitor I get nothing from the audio extractor.

What do I do with this?

Is there any way to use the HDMI audio as a simple 8 channel audio device?

I can use the USB SND8 (CMedia 6206) just fine, but I am interested in the built in capabilities of the Pi2 and I also like the fact that I might be able to play waves at 96KHz or even 192KHz sample rates.

James.

PS. The Pi2 is amazing. Great job! :)

Hi James, did you ever get any joy using the HDMI audio as a simple 8 channel audio device? Also, is the CMedia 6206 effectively a surround sound breakout box/chip using USB?
Thanks
Ric

johngummerson
Posts: 1
Joined: Tue Mar 24, 2015 2:56 pm

Re: Analog audio problems? post comments here!

Wed Mar 25, 2015 8:05 am

I am just starting to use a Pi2 Model B. it is connected to a TV via HDMI but I cannot get any sound. I have also connected earphones to the audio jack, but again no sound. Can anyone help please.

User avatar
DougieLawson
Posts: 30448
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Analog audio problems? post comments here!

Wed Mar 25, 2015 9:48 am

Try this:
sudo amixer cset numid=3 2
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

Return to “Troubleshooting”

Who is online

Users browsing this forum: i486, mahjongg, mvandoornik, watsonemily792 and 44 guests