Example audio line¶
Objective¶
This wiki page demonstrates how to verify that the audio out and audio in lines are working.
Prerequisites¶
- Audio speaker or stereo headphones with a 3.5mm plug in order to listen to the audio
- Audio stereo cable with 3.5mm plug at both ends (or a microphone with a 3.5mm plug)
- Locate the audio sockets on the dev-kit.
Steps¶
Audio Out
- Enter the following commands to adjust the output volume
amixer set PCM 100% amixer set 'Line DAC' 100%
- Plug the speaker or headphones into the Stereo Out socket.
- Enter the following command to play a 440 Hz tone which alternates 5 times between the left and right channels
speaker-test -c2 -f440 -t sine -l 5
- You should hear a tone which alternates between the left and right speakers or the left and right sides of the headphones. If you only have a mono speaker, then you will just hear a steady tone.
Audio In
- Enter the following command to adjust the input volume
amixer set PGA 100%
- When using a stereo audio cable
- Plug one end of the cable into the Stereo Out socket and one end of the cable into the Line In socket.
- Create two terminal windows into the device (use the serial console and an ssh connection or 2 ssh connections)
- In one terminal enter this command
speaker-test -c2 -f440 -t sine -l 5
- In the other terminal enter this command
arecord -f dat test.wav
- When the speaker-test command finishes, hit ctrl-C in the second window to stop the arecord.
- Remove the cable from the Stereo Out socket and insert the speaker or headphones
- Enter the following command to playback the recorded audio
aplay test.wav
- You should hear the tone that was generated by the speaker-test command.
- Note 1: While the speaker-test command alternated between left and right so you could hear the individual channels, the recording through the Line In seems to be turned into a mono signal so there isn't any alternating between the channels in the recorded wav file.
- Note 2: While 100Hz tones can be heard from speaker-test in the speakers, a 100Hz tone does not seem to be recorded when using an audio cable. 440Hz tone is ok, but not the 100Hz tone.???
- When using a microphone.
- Start recording using this command
arecord -f dat test_mic.wav
- Say something deep and profound
- Hit ctrl-C to stop the record.
- Connect the speaker to the Stereo Out socket.
- Use the following command to play the recording
aplay test_mic.wav
- You should hear your recorded message
- Start recording using this command
Conclusion¶
This wiki page has demonstrated how to verify that the Stereo Out is working and then how to make a recording from the Line In and play it back.
Go to top