Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Raspberry Pi Server Essentials

You're reading from  Raspberry Pi Server Essentials

Product type Book
Published in Feb 2014
Publisher
ISBN-13 9781783284696
Pages 116 pages
Edition 1st Edition
Languages
Author (1):
Piotr J Kula Piotr J Kula
Profile icon Piotr J Kula

Playing audio


The latest Raspbian image comes with all the sound drivers and utilities installed. The packages that are used belong to ALSA. The Pi has no way to record audio, as it has no microphone jack and the GPIO pins are all digital. To record audio using GPIO, we need to use an A/D (Analogue-to-Digital) device or a USB sound device that has a microphone input.

Using aplay

The following is a pre-installed package that plays WAV files:

# cd /tmp
# wget http://goo.gl/Ps3paV
# mv Ps3paV siren.wav
# aplay siren.wav

Using OMXPlayer

We can play back mp3 files using OMXPlayer.

# omxplayer audio-test.mp3

Using AirPlayer

There is a project called shairport which works really well on the Pi. It does not support videos or photos, but streaming music is very stable. We will need to get the project and compile it. This will only take a few minutes.

# cd /tmp
# git clone -b 1.0-dev git://github.com/abrasive/shairport.git
# cd shairport
# sudo ./configure && sudo make && sudo make install...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}