Saturday, 12 May 2012

Getting Sound Working.

This seems to be poorly documented.

/opt/vc/src/hello_pi/hello_audio
make
hello_audio.bin 1 will then play via hdmi.
or hello_audio.bin via analogue, and demonstrates that sound is working.

sudo modprobe snd_bcm2835 appears to load the kernel modules OK.

From http://elinux.org/R-Pi_Troubleshooting#Sound

sudo amixer cset numid=3 <n>
where n is 0=auto, 1=headphones, 2=hdmi.

apt-get install linux-sound-base
apt-get install alsa-utils

(probably would install linux-sound-base with alsa-utils - not sure).

Now - amixer cset numid=3 2
now 'speaker-test' - This produces some output via HDMI speakers... good.



root@raspberrypi:/usr/share/sounds/alsa# ls |while read f
> do
> aplay ${f}
> done
Playing WAVE 'Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Playing WAVE 'Front_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Playing WAVE 'Front_Right.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Playing WAVE 'Noise.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Playing WAVE 'Rear_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Playing WAVE 'Rear_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Playing WAVE 'Rear_Right.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Playing WAVE 'Side_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Playing WAVE 'Side_Right.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

These all play, albeit very poorly.

sudo apt-get install mplayer
Can now play mp3 pretty well... mplayer frank.mp3.




No comments:

Post a Comment

Note: only a member of this blog may post a comment.