This example demonstrates how to build an image with audio support, record audio from your mobile phone
and play it back.
Preparing the image
The first step is to build an image with ALSA utils. If you have not yet
build any images with Yocto, visit this page. If you have already set up build host,
then navigate to
OES Prime-image directory.
meta-layers/meta-emlid-OES Prime-examples/recipes-core/images/OES Prime-image.bbappend
and uncomment the following line:
IMAGE_INSTALL_append += "alsa-utils"
alsa-utils is a Yocto recipe that contains alsamixer, aplay and arecord utilities which we will use
to configure audio settings, input and output devices.
Build the image itself:
source init.sh bitbake OES Prime-image
Flash OES Prime with the newly created image, boot and log in.
analog-codec overlay to
Then reboot and connect your mobile phone to LINEIN port with 3.5mm cable.
alsamixer and go to [Capture] tab by pressing F4 button. You should see the following window:
Press space button under Line In so that the CAPTURE title is appeared. Press esc and quit alsamixer.
Now you are able to record playing sound from your mobile phone:
arecord -f cd -d 5 test.wav
alsamixer again and make sure that your playback settings are similar to these:
To play the recorded sound you need to connect your speakers to the LINEOUT port.
Specified for 10 kOhm impedance. Do not connect the headphones to LINEOUT, it can
damage your device.
aplay -i -f cd test.wav