We use the command amixer to view the content of the sound card:
# amixer contents
numid=7,iface=CARD,name='Headphone Jack'
; type=BOOLEAN,access=r-------,values=1
: values=on
numid=8,iface=CARD,name='Headset Mic Jack'
; type=BOOLEAN,access=r-------,values=1
: values=off
numid=9,iface=MIXER,name='Headphone Switch'
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=2,iface=MIXER,name='Capture MIC Path'
; type=ENUMERATED,access=rw------,values=1,items=4
; Item #0 'MIC OFF'
; Item #1 'Main Mic'
; Item #2 'Hands Free Mic'
; Item #3 'BT Sco Mic'
: values=3
numid=1,iface=MIXER,name='Playback Path'
; type=ENUMERATED,access=rw------,values=1,items=11
; Item #0 'OFF'
; Item #1 'RCV'
; Item #2 'SPK'
; Item #3 'HP'
; Item #4 'HP_NO_MIC'
; Item #5 'BT'
; Item #6 'SPK_HP'
; Item #7 'RING_SPK'
; Item #8 'RING_HP'
; Item #9 'RING_HP_NO_MIC'
; Item #10 'RING_SPK_HP'
: values=3
numid=5,iface=MIXER,name='DACL Capture Volume'
; type=INTEGER,access=rw---R--,values=1,min=0,max=255,step=0
: values=255
| dBscale-min=-95.00dB,step=0.37dB,mute=1
numid=3,iface=MIXER,name='DACL Playback Volume'
; type=INTEGER,access=rw---R--,values=1,min=0,max=255,step=0
: values=235
| dBscale-min=-95.00dB,step=0.37dB,mute=1
numid=6,iface=MIXER,name='DACR Capture Volume'
; type=INTEGER,access=rw---R--,values=1,min=0,max=255,step=0
: values=255
| dBscale-min=-95.00dB,step=0.37dB,mute=1
numid=4,iface=MIXER,name='DACR Playback Volume'
; type=INTEGER,access=rw---R--,values=1,min=0,max=255,step=0
: values=235
| dBscale-min=-95.00dB,step=0.37dB,mute=1
numid=12,iface=MIXER,name='Headset Mic Switch'
; type=BOOLEAN,access=rw------,values=1
: values=off
numid=11,iface=MIXER,name='Main Mic Switch'
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=10,iface=MIXER,name='Speaker Switch'
; type=BOOLEAN,access=rw------,values=1
: values=on
When using the speaker to play, we need to switch the playback path to SPK and switch through amixer:
# amixer -c 0 cset numid=1 2
numid=2,iface=MIXER,name='Playback Path'
; type=ENUMERATED,access=rw------,values=1,items=11
; Item #0 'OFF'
; Item #1 'RCV'
; Item #2 'SPK'
; Item #3 'HP'
; Item #4 'HP_NO_MIC'
; Item #5 'BT'
; Item #6 'SPK_HP'
; Item #7 'RING_SPK'
; Item #8 'RING_HP'
; Item #9 'RING_HP_NO_MIC'
; Item #10 'RING_SPK_HP'
: values=2
Play WAV file for testing, use APLay to verify:
# aplay /etc/demo.wav
Playing WAVE '/etc/demo.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
When using mic, we need to turn on the mic function and open it through amixer:
# amixer -c 0 cset numid=1 1
numid=3,iface=MIXER,name='Capture MIC Path'
; type=ENUMERATED,access=rw------,values=1,items=4
; Item #0 'MIC OFF'
; Item #1 'Main Mic'
; Item #2 'Hands Free Mic'
; Item #3 'BT Sco Mic'
: values=1
Perform recording function and verify with amixer:
# arecord -D hw:0,0 -c 2 -f S16_LE -r 44100 /data/youyeetoo.wav
Recording WAVE '/data/youyeetoo.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
^CAborted by signal Interrupt...
Play the youyeetoo.wav file for testing, and use aplay to verify:
# aplay /data/youyeetoo.wav
Playing WAVE '/data/youyeetoo.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
When playing with headphones, we need to switch the playback path to SPK and switch through amixer:
# amixer -c 0 cset numid=1 3
numid=2,iface=MIXER,name='Playback Path'
; type=ENUMERATED,access=rw------,values=1,items=11
; Item #0 'OFF'
; Item #1 'RCV'
; Item #2 'SPK'
; Item #3 'HP'
; Item #4 'HP_NO_MIC'
; Item #5 'BT'
; Item #6 'SPK_HP'
; Item #7 'RING_SPK'
; Item #8 'RING_HP'
; Item #9 'RING_HP_NO_MIC'
; Item #10 'RING_SPK_HP'
: values=3
Play WAV file for testing, use APLay to verify:
# aplay /etc/demo.wav
Playing WAVE '/etc/demo.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo