VAR-SOM-MX6 Audio record play: Difference between revisions
From Variscite Wiki
(9 intermediate revisions by 3 users not shown) | |||
Line 9: | Line 9: | ||
imx-hdmi-soc | imx-hdmi-soc | ||
</pre> | </pre> | ||
List device names: | {{note|Note: imx-hdmi-soc will be listed only if an HDMI cable is connected.|info}} | ||
List device names for playback: | |||
<pre> | <pre> | ||
root@var-som-mx6:~# aplay -L | root@var-som-mx6:~# aplay -L | ||
Line 39: | Line 40: | ||
= Audio Playback = | = Audio Playback = | ||
Set volume: | Set PCM volume (main volume of audio codec), range :0-127 | ||
<pre>$ amixer set PCM | <pre>$ amixer set PCM 127</pre> | ||
Play audio: | Play audio: | ||
<pre> | <pre> | ||
Line 59: | Line 60: | ||
</pre> | </pre> | ||
= Audio Record = | = Audio Record and Play, Line-in Jack= | ||
<pre> | <pre> | ||
$ arecord -f cd -d 10 -D hw:0,0 test.wav | $ arecord -f cd -d 10 -D hw:0,0 test.wav | ||
Line 72: | Line 73: | ||
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo | Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo | ||
</pre> | </pre> | ||
= Advanced Controls = | = Advanced Controls = | ||
amixer | amixer without a parameter will show all available controls. | ||
For example: | |||
<pre> | |||
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] | |||
</pre> | |||
Options: | |||
<pre> | |||
amixer sset sID P set contents for one mixer simple control | amixer sset sID P set contents for one mixer simple control | ||
amixer sget sID get contents for one mixer simple control | amixer sget sID get contents for one mixer simple control | ||
</pre> | |||
amixer sget 'HP DAC' | For example: | ||
<pre> | |||
$ amixer sget 'HP DAC' | |||
Simple mixer control 'HP DAC',0 | Simple mixer control 'HP DAC',0 | ||
Capabilities: pvolume | Capabilities: pvolume | ||
Line 85: | Line 116: | ||
Front Left: Playback 71 [60%] [-23.50dB] | Front Left: Playback 71 [60%] [-23.50dB] | ||
Front Right: Playback 71 [60%] [-23.50dB] | Front Right: Playback 71 [60%] [-23.50dB] | ||
</pre> | |||
HP DAC is a headphones DAC gain currently set to 60%. | HP DAC is a headphones DAC gain currently set to 60%. | ||
The optional values are 0-118 equal to 0%-100%. | |||
<pre> | |||
$ 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] | |||
</pre> | |||
Headphones DAC gain currently now set to 99%. | |||
= Save / restore system's audio settings = | |||
alsactl store stores all alsamixer settings into a file<br> | |||
alsctl | alsctl | ||
Options: | |||
<pre> | |||
store <card> save current driver setup for one or each soundcards | store <card> save current driver setup for one or each soundcards | ||
to configuration file | to configuration file | ||
restore <card> load current driver setup for one or each soundcards | restore <card> load current driver setup for one or each soundcards | ||
from configuration file | from configuration file | ||
alsactl store -f 123.conf | </pre> | ||
alsactl restore | Example: | ||
<pre> | |||
$ alsactl store -f 123.conf | |||
$ alsactl restore -f 123.conf | |||
</pre> |
Latest revision as of 11:28, 22 August 2017
VAR-SOM-MX6 - Audio Record/Play
Get information on the Sound Cards
Installed devices:
root@var-som-mx6:~# cat /proc/asound/cards 0 [tlv320aic3xaudi]: tlv320aic3x-aud - tlv320aic3x-audio tlv320aic3x-audio 1 [imxhdmisoc ]: imx-hdmi-soc - imx-hdmi-soc imx-hdmi-soc
Note: imx-hdmi-soc will be listed only if an HDMI cable is connected.
List device names for playback:
root@var-som-mx6:~# aplay -L null Discard all samples (playback) or generate zero samples (capture) sysdefault:CARD=tlv320aic3xaudi tlv320aic3x-audio, Default Audio Device sysdefault:CARD=imxhdmisoc imx-hdmi-soc, Default Audio Device surround40:CARD=imxhdmisoc,DEV=0 imx-hdmi-soc, 4.0 Surround output to Front and Rear speakers surround41:CARD=imxhdmisoc,DEV=0 imx-hdmi-soc, 4.1 Surround output to Front, Rear and Subwoofer speakers surround50:CARD=imxhdmisoc,DEV=0 imx-hdmi-soc, 5.0 Surround output to Front, Center and Rear speakers surround51:CARD=imxhdmisoc,DEV=0 imx-hdmi-soc, 5.1 Surround output to Front, Center, Rear and Subwoofer speakers surround71:CARD=imxhdmisoc,DEV=0 imx-hdmi-soc, 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
Audio Playback
Set PCM volume (main volume of audio codec), range :0-127
$ amixer set PCM 127
Play audio:
$ aplay /usr/share/sounds/alsa/Front_Center.wav
Example:
root@var-som-mx6:~# amixer set PCM 125 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] root@var-som-mx6:~# 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