Hardware Reference
In-Depth Information
Switching between HDMI and analog audio
output
As you may recall, the Raspberry Pi has two possible audio outputs. We can either
send sound to our monitor or TV through the HDMI cable, or we can send it out of
the 3.5 mm analog audio jack to a plugged-in pair of headphones or speakers.
Use the raspi-config utility to change this setting, or use the amixer command to
flip a virtual switch that determines the path of the audio output in the following
two ways:
amixer cset numid=3 1 : This sets the audio out to the 3.5 mm analog jack.
amixer cset numid=3 2 : This sets the audio out to the HDMI cable.
Testing the speakers
Now that you've decided where to send the sound, type in the following command
to test your speakers:
pi@raspberrypi ~ $ speaker-test -c2 -t wav
With a bit of luck, you should hear a woman's voice say Front Left in your left-hand
side speaker and Front Right in your right-hand side speaker. These words will be
repeated until you overcome the urge to start marching and press Ctrl + C to quit the
speaker-test application.
Preparing to record
Go ahead and plug in your USB microphone, headset, or webcam now and let's see
what it can do. You might want to shut down your Pi first before inserting your
device—hot-plugging gadgets into a Pi has been known to cause reboots.
We can check whether ALSA has detected our new audio device and added it to the
list of cards using the following command:
pi@raspberrypi ~ $ cat /proc/asound/cards
In the following screenshot, a Plantronics USB Headset was attached and assigned
card number one.
List of detected ALSA cards showing a new addition
 
Search WWH ::




Custom Search