Skip to content

Instantly share code, notes, and snippets.

@shamim71
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shamim71/0dbe4f4c5a2e3ee084a9 to your computer and use it in GitHub Desktop.
Save shamim71/0dbe4f4c5a2e3ee084a9 to your computer and use it in GitHub Desktop.
Playing sound file in Raspberry PI
#Installaing Driver
sudo apt-get install alsa-utils
#Loading driver module
sudo modprobe snd_bcm2835
#Pointing output port to analog output.
# sudo amixer cset numid=3 <n>
# Where <n> is the required interface : 0=auto, 1=analog, 2=hdmi. To force the Raspberry Pi to use the analog output :
sudo amixer cset numid=3 1
# Getting a sample audio file
sudo wget http://www.freespecialeffects.co.uk/soundfx/sirens/police_s.wav
#Playing the file
sudo aplay police_s.wav
Reference:
http://www.raspberrypi-spy.co.uk/2012/06/raspberry-pi-speakers-analog-sound-test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment