Audio

The phyCORE-AM62x SOM provides three Multichannel Audio Serial Ports (MCASPs). The MCASPs function as general-purpose audio serial ports optimized for the needs of multichannel audio applications. This guide will show how to play and record audio with the phyCORE-AM62x development kit. To learn more information about the phyCORE-AM62X MCASPs (Audio), please see section 7.7 in the Hardware Manual.

phyCORE-AM62x Audio

Requirements

  • Headset with Microphone and CTIA Jack

Development Kit Hardware Setup

The phyCORE-AM62x development kit can work with two different international audio jack hardware standards. The default setting is the CTIA, an audio standard used in the majority of international markets. The other headset standard is called OMTP, which is commonly used in China. The development kit is able to switch back and forth by moving two solder-on jumpers (J36, J37) to the proper configurations shown in the table below.

Jumper Settings for Audio

Mode

J36

J37

OTMP

2+3

1+2

CTIA (Default)

1+2

2+3

phyCORE-AM62x CTIA vs OMTP phyCORE-AM62x Audio

Playing an Audio File

  • First copy an audio file onto the development kit. This example will use the wget command, which requires a network connection. Discover more mediums that can assist in copying files by following the guide Copying Files to the Device.

  • Use the following command to download an audio file to the development kit.

Host
wget https://www2.cs.uic.edu/~i101/SoundFiles/ImperialMarch60.wav

Note

You can find more audio files here.

  • Plug a headset into the audio header (X23).

  • Play the audio file.

Target (Linux)
aplay ImperialMarch60.wav
Expected Output
root@phyboard-lyra-am62xx-1:~# aplay ImperialMarch60.wav
Playing WAVE 'ImperialMarch60.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono

Recording Audio

  • With a headset plugged into the X23 audio port, run the following command to record audio and loop it back into the headset:

Target (Linux)
arecord --device=sysdefault -f S16_LE -c1 -r32000 | aplay --device=sysdefault
Expected Output
root@phyboard-lyra-am62xx-2:~# arecord --device=sysdefault -f S16_LE -c1 -r32000 | aplay --device=sysdefault
Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 32000 Hz, Mono
Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 32000 Hz, Mono

Note

If you are using earbuds with a microphone during development, please be aware that these earbuds typically lack an internal ground wire, preventing users from recording themselves. To resolve this issue, you can switch J15 to the 1+2 position.

../_images/pb-07124_audio-J15.png

Audio Mixer Settings

Control volume and various other audio setting using the ALSA soundcard driver’s ‘amixer’ or ‘alsamixer’ commands.

Changing Settings via GUI

The command ‘alsamixer’ allows the user to adjust, volume, soundcard devices and many other settings with an interactive GUI. This command is recommended for users who are note familiar with ALSA.

  • Use the following command to access the settings GUI.

    Target (Linux)
    alsamixer
    
  • Press “F6” to access the phyBOARD-Lyra sound card settings.

    ../_images/pb-07124_audio_ALSAMixerGUI-soundcard.jpg
  • Change settings by utilizing your keyboard arrow keys.

    phyCORE-AM62x ALSA Mixer GUI
  • Exit GUI by pressing the “esc”.

  • It is a good practice to save the mixer settings found to be good and reload them after every boot.

    Target (Linux)
    alsactl -f board.aconf store
    
  • When you decide to reboot the development kit, run the following command to restore mixer settings.

    Target (Linux)
    alsactl -f board.aconf restore
    

Changing Settings via Terminal Commands

The command ‘amixer’ allows the user to adjust, volume, soundcard devices and many other settings with terminal commands. This command is recommended for users who are familiar with ALSA.

  • For example, the following command sets the soundcard’s left line input volume to 80% and right line input to 40%, unmute it, and select it as a source for capture (recording).

    Targetr (Linux)
    amixer -c 0 sset Line,0 80%,40% unmute cap
    
  • To learn more about this tool use the ‘–help’ command to see the various options available

    Target (Linux)
    amixer --help