Testing audio on PICO-PI with Linux

Difficulty Levels: Beginner
Date added: August 21, 2018
Affected Products: PICO-IMX6 , PICO-IMX6UL-EMMC , PICO-IMX7 , PICO-IMX8M , PICO-PI , PICO-PI-8M , PICO-PI-IMX8M

This article takes you through the steps to test audio the Pico SoM using the PICO-PI baseboard. This baseboard makes use of an integrated headphone and microphone jack. This is best tested with combo stereo headset and mic used in standard mobile handsets.

We have tested using the following headsets:

https://www.jbl.com/earbuds/JBL+T110.html

https://www.cyberacoustics.com/store/Products/Headsets/AC-204

Apple combo headphones for mobile handsets do not work with Pico Pi.

Step 1 – Audio playback test

To play files “left.wav” and “right.wav” issue the commands:

# aplay left.wav
and
# aplay right.wav
or
# speaker-test -t wav -c 2 -D hw:0

The filenames can be anything as long as they can test the right and left channels. If you don’t have a .wav audio file to use for testing, you should be able to easily find one on the net, such as this one: http://www.kozco.com/tech/LRMonoPhase4.wav

If you have your unit connected to a local network, you can easily download this file:
# wget http://www.kozco.com/tech/LRMonoPhase4.wav
Then you can play it:
# aplay LRMonoPhase4.wave

Step 2 – Test audio recording using a microphone

Set the microphone as the capture device:

In the terminal prompt:
# amixer sset 'Capture Mux' 'MIC_IN'
# amixer sset 'Capture' 100
Set the mic volume to 2 (67%). We found that on most headsets, the gain is too high and the recorded sound is quite distorted.
# amixer sset 'Mic' 2

Connect the microphone and use the command:
# arecord -d 5 -vv -fdat /tmp/test.wav

This will record for 5 seconds. You can also use Ctrl+C to stop recording.

Verify that the recording works by playing back the sound by:
# aplay /tmp/test.wav

Stay up to date with all the latest TechNexion news...

Sign-up for our Newsletter