Letux Kernel

Sound

Table of Content

How to set ALSA mixer settings for speakers, headset, microphone etc.

Basic

amixer set 'DAC1 Analog' off
amixer set 'DAC2 Analog' on
amixer set 'Codec Operation Mode' 'Option 1 (audio)'

Headset

echo 1 >/sys/devices/virtual/gpio/gpio55/value  # enable audio out
amixer set 'Headset' 2
amixer set 'HeadsetL Mixer AudioL1' off
amixer set 'HeadsetL Mixer AudioL2' on
amixer set 'HeadsetL Mixer Voice' off
amixer set 'HeadsetR Mixer AudioR1' off
amixer set 'HeadsetR Mixer AudioR2' on
amixer set 'HeadsetR Mixer Voice' off
aplay /usr/share/sounds/alsa/Front_Center.wav 
amixer set 'HeadsetL Mixer AudioL2' off
amixer set 'HeadsetR Mixer AudioR2' off

Vibrasound

amixer set Vibra Audio
amixer set 'Vibra H-bridge direction' 'Positive polarity'
amixer set 'Vibra H-bridge mode' 'Audio data MSB'
amixer set 'Vibra Mux' AudioL2
aplay /usr/share/sounds/alsa/Front_Center.wav 
amixer set Vibra 'Local vibrator'

Earpiece

amixer set Earpiece 100%
amixer set 'Earpiece Mixer AudioL1' off
amixer set 'Earpiece Mixer AudioR1' off
amixer set 'Earpiece Mixer AudioL2' on
amixer set 'Earpiece Mixer Voice' off
aplay /usr/share/sounds/alsa/Front_Center.wav 
amixer set 'Earpiece Mixer AudioL2' off

Handsfree

amixer set HandsfreeL on
amixer set HandsfreeR on
amixer sset 'Analog' 5
amixer set 'HandsfreeL Mux' AudioL2
amixer set 'HandsfreeR Mux' AudioR2
aplay /usr/share/sounds/alsa/Front_Center.wav 
amixer set HandsfreeL off
amixer set HandsfreeR off

internal Microphone

amixer set TX1 'Analog'
amixer set 'TX1 Digital' 12
amixer set 'Analog Left AUXL' nocap
amixer set 'Analog Right AUXR' nocap
amixer set 'Analog Left Main Mic' cap
amixer set 'Analog Left Headset Mic' nocap
amixer set 'Analog' 3   # avoid echo
arecord | tee record.wav | aplay

Headset Microphone

echo 0 >/sys/devices/virtual/gpio/gpio23/value  # switch off video out
amixer set 'Analog' 5
amixer set TX1 'Analog'
amixer set 'TX1 Digital' 12
amixer set 'Analog Left AUXL' nocap
amixer set 'Analog Right AUXR' nocap
amixer set 'Analog Left Main Mic' nocap
amixer set 'Analog Left Headset Mic' cap
arecord | tee record.wav | aplay

AUX-In

echo 0 >/sys/devices/virtual/gpio/gpio55/value  # disable audio out
amixer set 'Analog' 5
amixer set TX1 'Analog'
amixer set 'TX1 Digital' 12
amixer set 'Analog Left AUXL' cap
amixer set 'Analog Right AUXR' cap
amixer set 'Analog Left Main Mic' nocap
amixer set 'Analog Left Headset Mic' nocap
arecord | tee record.wav | aplay