> For the complete documentation index, see [llms.txt](https://amobile-solutions.gitbook.io/yocto-developer-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://amobile-solutions.gitbook.io/yocto-developer-guide/test-and-use-the-interface/audio/audio-sd52x-sd72x.md).

# Audio - SD52x/SD72x

## Get information on the Sound Cards

Installed devices:

```
root@sd520:~# cat /proc/asound/cards
 0 [mt8391evk      ]: mt8391-evk - mt8391-evk
                      mt8391-evk
```

List device names for playback:

```
root@sd520:~# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
pipewire
    PipeWire Sound Server
sysdefault:CARD=mt8391evk
    mt8391-evk
    Default Audio Device
```

## Audio Playback from speaker

Get speaker volume

```
amixer -c 0 cget name='Speaker Driver Playback Volume'
```

Set speaker volume, range : (Maximum) 0 - 255 (Minimum), default: 44

```
amixer -c 0 cset name='Speaker Driver Playback Volume' <Volume>
```

Play audio:

```
aplay /usr/share/sounds/alsa/Front_Center.wav
```

Example:

```
root@sd520:~# amixer -c 0 cget name='Speaker Driver Playback Volume'
numid=352,iface=MIXER,name='Speaker Driver Playback Volume'
  ; type=INTEGER,access=rw---R--,values=1,min=0,max=255,step=0
  : values=44
  | dBscale-min=-103.50dB,step=0.50dB,mute=0
root@sd520:~# amixer -c 0 cset name='Speaker Driver Playback Volume' 80
numid=352,iface=MIXER,name='Speaker Driver Playback Volume'
  ; type=INTEGER,access=rw---R--,values=1,min=0,max=255,step=0
  : values=80
  | dBscale-min=-103.50dB,step=0.50dB,mute=0
root@sd520:~# aplay /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
```

## Audio Record from DMIC

Record audio for 5 seconds into file sample.wav

```
arecord -r 48000 -f S32_LE -d 5 sample.wav
```

Play the recorded file

```
aplay sample.wav 
```

Example:

```
root@sd520:~# arecord -r 48000 -f S32_LE -d 5 sample.wav
Recording WAVE 'sample.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Mono
root@sd520:~# aplay sample.wav
Playing WAVE 'sample.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Mono
```
