HOME

  • ABOUT
  • PORTFOLIO
  • NEWS, TECH & ART
    • Websites
    • WordPress Plugins
    • Processing.org
    • Neural networks
    • New Media Art
  • RASPBERRY PI
  • ABOUT
  • PORTFOLIO
  • NEWS, TECH & ART
    • Websites
    • WordPress Plugins
    • Processing.org
    • Neural networks
    • New Media Art
  • RASPBERRY PI
Raspberry PI – getting audio working

Raspberry PI – getting audio working

  • alsa, audio, lame, mp3, mpg321, raspberry pi, sound, wav

logoHow to get the audio working on your Raspberry PI?

You have to install three packages:

  • The ALSA utilities:
    sudo apt-get install alsa-utils
  • MP3 tools:
    sudo apt-get install mpg321
  • WAV to MP3 conversion tool:
    sudo apt-get install lame

Load the sound driver:

  • sudo modprobe snd-bcm2835

To check if the driver is loaded you can type:

  • sudo lsmod | grep 2835

Select the output device for sound (0=auto, 1=analog, 2=HDMI):

  • sudo amixer cset numid=2

Test the installation:

  • aplay /usr/share/sounds/alsa/Front_Center.wav
  • speaker-test -t sine -f 440 -c 2 -s 1
  • mpg321 “Mannish Boy.mp3”

It you get the following error message:

  • ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front

Edit the file /usr/share/alsa/alsa.conf:

  • sudo nano /usr/share/alsa/alsa.conf
  • change the line “pcm.front cards.pcm.front” to “pcm.front cards.pcm.default”

If you are using HDMI and cannot hear any audio at all change the following PI configuration setting:

  • edit the RasPI configuration file:
    sudo nano /boot/config.txt
  • uncomment the line:
    hdmi_drive=2
  • save the file and reboot the PI

Resources:

  • http://jeffskinnerbox.wordpress.com/2012/11/15/getting-audio-out-working-on-the-raspberry-pi/
  • http://elinux.org/R-Pi_Troubleshooting
previous article next article
profile background
profile image

Rolf van Gelder

Owner of CAGE Web Design

CAGE was established in the year 2000

What’s new?

  • WebImageLoader – Processing Library
  • Responsive P5JS for WP – WordPress plugin
  • Optimize Database after Deleting Revisions – WordPress plugin
© 1995-2025 CAGE Web Design, Eindhoven, NL | +31 (0)6 22 66 3193