DART-6UL/VAR-SOM-MX7 Audio record play

From Variscite Wiki
Revision as of 15:33, 27 December 2015 by Ron (talk | contribs) (→‎Audio Playback)
DART-6UL - Audio Record/Play

Get information on the Sound Cards

Installed devices:

rroot@imx6ul-var-dart:~# cat /proc/asound/cards
 0 [wm8731audio    ]: wm8731-audio - wm8731-audio
                      wm8731-audio

List device names for playback:

root@imx6ul-var-dart:~# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=wm8731audio
    wm8731-audio, 
    Default Audio Device

Audio Playback

Set PCM volume (main volume of audio codec), range :0-125

$ amixer set Master 125
$ amixer set 'Output Mixer HiFi' on

Play audio:

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

Example:

root@imx6ul-var-dart:~# amixer set Master 125
Simple mixer control 'Master',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 127
  Mono:
  Front Left: Playback 125 [98%] [4.00dB]
  Front Right: Playback 125 [98%] [4.00dB]
root@imx6ul-var-dart:~# 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 and Play, Line-in Jack

$ arecord -f cd -d 10 -D hw:0,0 test.wav
$ aplay test.wav 

Example:

root@var-som-mx6:~# arecord -f cd -d 10 -D hw:0,0 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
root@var-som-mx6:~# ^C
root@var-som-mx6:~# aplay test.wav
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

Advanced Controls

amixer without a parameter will show all available controls. For example:

root@var-som-mx6:~# amixer
Simple mixer control 'PCM',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 127
  Mono:
  Front Left: Playback 125 [98%] [-1.00dB]
  Front Right: Playback 125 [98%] [-1.00dB]
Simple mixer control 'Line',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]

...

Simple mixer control 'Right PGA Mixer Mic3R',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]

Options:

amixer   sset sID P      set contents for one mixer simple control
amixer   sget sID        get contents for one mixer simple control

For example:

$ amixer   sget 'HP DAC'
Simple mixer control 'HP DAC',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 118
  Mono:
  Front Left: Playback 71 [60%] [-23.50dB]
  Front Right: Playback 71 [60%] [-23.50dB]

HP DAC is a headphones DAC gain currently set to 60%. The optional values are 0-118 equal to 0%-100%.

$ amixer   sset 'HP DAC' 117 117
Simple mixer control 'HP DAC',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 118
  Mono:
  Front Left: Playback 117 [99%] [-0.50dB]
  Front Right: Playback 117 [99%] [-0.50dB]

Headphones DAC gain currently now set to 99%.

Save / restore system's audio settings

alsactl store stores all alsamixer settings into a file
alsctl Options:

  store     <card>  save current driver setup for one or each soundcards
                      to configuration file
  restore   <card>  load current driver setup for one or each soundcards
                      from configuration file

Example:

$ alsactl store -f 123.conf
$ alsactl restore -f 123.conf