Raspberry-Pi Enable Sound

SOUND
How to enable sound on Raspberry-Pi HDMI and Analog (Raspbian-Wheezy)
*Before starting startx
Use SuperUser (After every reboot) or use sudo before any command
sudo su
Install Firmware Updater
apt-get install ca-certificates git-core binutils
wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update
cp rpi-update /usr/local/bin/rpi-update
chmod +x /usr/local/bin/rpi-update
Update Firmware
sudo rpi-update
Uncomment "hdmi_drive=2" on config.txt
nano /boot/config.txt
Install ALSA, MPlayer and PulseAudio
apt-get install mplayer mplayer-gui alsa-base alsa-utils pulseaudio mpg123
Add audio module to kernel
modprobe snd_bcm2835
echo 'snd_bcm2835' >> /etc/modules
Configure ALSA driver for n Analog=1 HDMI=2 (Auto=0 Not recommended)
amixer cset numid=3 n
Replace asound.conf with:
   pcm.!default {
   type hw
   card 0
   }

   ctl.!default {
   type hw
   card 0
   }
nano /etc/asound.conf
Reboot Raspberry Pi
reboot
Test audio without ALSA
cd /opt/vc/src/hello_pi/
 ./rebuild.sh
 cd hello_audio
Test analog output
 ./hello_audio.bin
Test HDMI
./hello_audio.bin 1
Test audio with ALSA
Test analog output
amixer cset numid=3 1
speaker-test -t sine -f 600
Test HDMI output
amixer cset numid=3 2
speaker-test -t sine -f 600
Download mp3 file Hello.mp3
wget http://semilleroadt.upbbga.edu.co/Raspberry-Pi/Hello.mp3
Play MP3 file
mpg123 Hello.mp3


Edited by Jose P Pinilla & Holguer A Becerra

Comments