Using RCA jack for audio


20 posts
by astrodog » Wed Dec 26, 2012 10:15 pm
Hi,

I am a complete noob. I installed xbian on my Pi and plugged it into my old TV, which doesnt take HDMI, I amanaged to play videos but I dont know how to get the sound to work. I tried plugging in the red and white jacks into the audio output of the Pi, but alas, it did not work - Is there anything I have to do toget the sound working as is (i.e. without having to buy more hardware?)

Thanks!!
Posts: 7
Joined: Wed Dec 26, 2012 10:09 pm
by sblar » Thu Dec 27, 2012 11:54 am
You need to tell pi where to send sound:

sudo amixer cset numid=3 <output>

0=auto
1=headphones
2=hdmi

In your case, run this command:
sudo amixer cset numid=3 1
Posts: 11
Joined: Sun Dec 02, 2012 7:08 pm
by astrodog » Thu Dec 27, 2012 8:48 pm
Hi,

Thanks for your advice. Unfortunately I exited the xbian and once I got to the commnd prompt I entered the commands you recommended but the command was not recognized...

Thanks
Posts: 7
Joined: Wed Dec 26, 2012 10:09 pm
by redhawk » Thu Dec 27, 2012 9:25 pm
Try: apt-get install alsa-utils then run amixer again.

Richard S.
User avatar
Posts: 1339
Joined: Sun Mar 04, 2012 2:13 pm
Location: currently on holiday
by astrodog » Fri Dec 28, 2012 2:21 am
Thanks Richard,
I tried your suggestion after using xbian as the login and raspberry as the password. I got the following reply:
Could not open lock file /var/lib/dpkg/lock - open (13:permission denied) Unable to lock the administration directory (/var/lib/dpkg/), are you root?

I have searched in vaious forums and they all seem to agree that xbian and raspberry are the root login... is there something I am missing?

Thanks!
Posts: 7
Joined: Wed Dec 26, 2012 10:09 pm
by rpdom » Fri Dec 28, 2012 7:16 am
Can you try sudo apt-get install alsa-utils

That should run the command as the "root" user.
Posts: 733
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK
by astrodog » Fri Dec 28, 2012 3:34 pm
Thanks everyone! I ran sudo apt-get update, then I ran sudo apt-get install alsa-utils, but when I try to run sudo amixer cset numid=3 1 it replies:

amixer: control default open error: no such file or directory

when I try to run just sudo amixer cset it replies:

Specify a full control identifier: [[iface=<iface>,][name='name',][index=<index>,][device=<device>,][subdevice=<subdevice>]]|[numid=<numid>]

Is there something I am missing?

Thanks
Posts: 7
Joined: Wed Dec 26, 2012 10:09 pm
by rpdom » Fri Dec 28, 2012 4:42 pm
Try sudo modprobe snd-bcm2835 then the sudo amixer command again.

If that works, you should add "snd-bcm2835" (without the quotes) to the end of /etc/modules to make this work automatically at boot time.
Posts: 733
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK
by sblar » Fri Dec 28, 2012 4:48 pm
You could try this:

sudo amixer cget numid=1
sudo amixer cget numid=2
sudo amixer cget numid=3
sudo amixer cget numid=4

I'm not sure what it will give you, but in my case numid=3 returns:
numid=3,iface=MIXER,name='PCM Playback Route'
; type=INTEGER,access=rw------,values=1,min=0,max=2,step=0
: values=1

and I guess that 'PCM Playback Route' is what we are looking for. Maybe it has another numid in your case, even though I can't imagine why.
Posts: 11
Joined: Sun Dec 02, 2012 7:08 pm
by sblar » Fri Dec 28, 2012 4:53 pm
Just remembered, you must first load the sound driver:
sudo modprobe snd_bcm2835
Posts: 11
Joined: Sun Dec 02, 2012 7:08 pm
by sblar » Fri Dec 28, 2012 5:03 pm
Last thing: To avoid having to start the sound driver after boot, make an entry in /etc/modules, like this;

sudo su
echo snd_bcm2835>>>>/etc/modules
exit

And to check the change:
cat /etc/modules
Posts: 11
Joined: Sun Dec 02, 2012 7:08 pm
by sblar » Fri Dec 28, 2012 5:05 pm
And I should learn to read before I post; rpdom has already said the same thing...
Posts: 11
Joined: Sun Dec 02, 2012 7:08 pm
by PaulusV » Sat Dec 29, 2012 1:15 pm
The audio output takes no white or red RCAjack, it needs a stereo 3.5 mm audio jack. You'll need a cable like the one here:
https://dx.com/p/3-5mm-audio-jack-male- ... -30cm-5143
Posts: 1
Joined: Sat Dec 29, 2012 1:10 pm
by sblar » Sat Dec 29, 2012 5:34 pm
Since there is not phono jacks on the Pi, I'm pretty sure astrodog meant the other end of the cable, when he said red and white jack ;)
Posts: 11
Joined: Sun Dec 02, 2012 7:08 pm
by astrodog » Sat Dec 29, 2012 5:38 pm
Hi guys, thanks for all your help, the pi community is awesome! I just tried Paulus' idea and it works like a charm!

Thanks again to all! :D
Posts: 7
Joined: Wed Dec 26, 2012 10:09 pm
by astrodog » Sat Dec 29, 2012 5:41 pm
Sblar, I plugged in the yellow jack for video and I was trying to use the red or white jacks... I figured just one of the jacks should do it.... obviously I was very wrong and like you say,the pi just doesnt take it.

Thanks for all your help^!!
Posts: 7
Joined: Wed Dec 26, 2012 10:09 pm
by davehiggins21 » Mon Jan 21, 2013 7:00 pm
I've been trying to set up the DLNA streaming system as specified by Stephen Phillips which I've managed to get working apart from getting the sound out of the RCA jack. I get the sound out via the HDMI port and when I issue the amixer command I get the following.

pi@raspberrypi ~ $ sudo amixer cset numid=3 1
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Access denied

amixer: Control default open error: Connection refused

Is there some connection with PulseAudio that is stopping the command working. I've had it working before without PulseAudio installed.

Cheers Dave
Posts: 37
Joined: Thu Jan 26, 2012 10:04 am
by astrodog » Mon Jan 21, 2013 7:10 pm
Hi dave,

have you tried the 3.5mm audio jack that Paulus suggested? It worked great for me
Posts: 7
Joined: Wed Dec 26, 2012 10:09 pm
by davehiggins21 » Tue Jan 22, 2013 8:56 am
Of course I didn't mean the Composite RCA Phono - I meant the 3.5 mm jack. The amixer command should switch the sound output from HDMI to the 3.5 mm jack but the command fails. I think I'll try reinstalling and setting it to the correct output before installing PulseAudio - might make the difference.

Dave
Posts: 37
Joined: Thu Jan 26, 2012 10:04 am
by davehiggins21 » Tue Jan 22, 2013 12:09 pm
Yes that worked fine. I redid the build after issuing the 'sudo amixer cset numid=3 1' command and kept checking that it worked by doing a 'sudo speaker-test' after each section of the install - and it all works.

yippee

Dave
Posts: 37
Joined: Thu Jan 26, 2012 10:04 am