You can read it. Embedded linux/android alsa_aplay alsa_amixer command line usage

Source: Internet
Author: User

A few days ago in the embedded Linux used to Alsa command, on-line check the data do not give force, only a little bit to check, and finally can use, will this use method to tell everyone, lest everyone less detours.

0. First check which ALSA cmd the system supports:

ll/system/bin/asla*

After checking, my android4.4.2+linux3.10 system supports the following ALSA cmd

-rwxr-xr-x root Shell 68242 2014-10-08 05:18 alsa_amixer
-rwxr-xr-x root Shell 67639 2014-10-08 05:18 Alsa_aplay
-rwxr-xr-x root Shell 130323 2014-10-08 05:18 Alsa_ctl

Different systems can be slightly different, for example some systems are called aplay\amixer .....

1. How to use Alsa_aplay:

Alsa_aplay-h//See what uses are currently supported

-H,--help help
--version Print Current version
-L,--list-devices list all soundcards and digital audio Devices
-L,--list-pcms list device names
-D,--device=name select PCM by NAME
-Q,--quiet quiet mode
-T,--file-type type file type (VOC, WAV, raw or AU)
-C,--channels=# channels
-F,--format=format sample format (case insensitive)
-R,--rate=# sample rate
-D,--duration=# interrupt after # seconds
-M,--mmap Mmap stream
-N,--nonblock nonblocking mode
-F,--period-time=# distance between interrupts is # microseconds
-B,--buffer-time=# buffer duration is # microseconds
--period-size=# distance between interrupts is # frames
--buffer-size=# buffer duration is # frames
-A,--avail-min=# min available space for wakeup is # microseconds
-R,--start-delay=# delay for automatic PCM start is # microseconds
(Relative to buffer size if <= 0)
-T,--stop-delay=# delay for automatic PCM stop was # microseconds from Xrun
-V,--verbose show PCM structure and setup (accumulative)
-V,--vumeter=type enable VU meter (Type:mono or stereo)
-I,--separate-channels one file for each channel
--disable-resample Disable automatic rate resample
--disable-channels Disable automatic channel conversions
--disable-format Disable automatic format conversions
--disable-softvol Disable Software Volume control (SOFTVOL)
--test-position Test Ring buffer position
--test-coef=# test coeficient for ring buffer position (default 8)
Expression for Validation Is:coef * (BUFFER_SIZE/2)
--test-nowait do not wait for ring buffer-eats whole CPU
--max-file-time=# start another output file when the old file has recorded
For this many seconds
--process-id-file write the process ID here
--use-strftime Apply the Strftime facility to the output file name

There will be detailed help instructions, this will not say, you can try.
ALSA_APLAY-L//list system has several sound cards (card 0/1/2 ...), and one device per card (Devices 0/1/2 ...)

For example, my system is:

List of PLAYBACK Hardware Devices * * * * *
Card 0:loopback [Loopback], device 0:loopback PCM [Loopback PCM]
Subdevices:8/8
Subdevice #0: Subdevice #0
Subdevice #1: Subdevice #1
Subdevice #2: Subdevice #2
Subdevice #3: Subdevice #3
Subdevice #4: Subdevice #4
Subdevice #5: Subdevice #5
Subdevice #6: Subdevice #6
Subdevice #7: Subdevice #7
Card 0:loopback [Loopback], device 1:loopback PCM [Loopback PCM]
Subdevices:8/8
Subdevice #0: Subdevice #0
Subdevice #1: Subdevice #1
Subdevice #2: Subdevice #2
Subdevice #3: Subdevice #3
Subdevice #4: Subdevice #4
Subdevice #5: Subdevice #5
Subdevice #6: Subdevice #6
Subdevice #7: Subdevice #7
Card 1:INTELALSASSP [INTELALSASSP], device 0:bt_device [INTELALSASSP]
Subdevices:1/1
Subdevice #0: Subdevice #0
Card 1:INTELALSASSP [INTELALSASSP], device 2:builtin_device [INTELALSASSP]
Subdevices:1/1
Subdevice #0: Subdevice #0
Card 2:cloverviewaudio [Cloverview_audio], device 0:4 []
Subdevices:2/2
Subdevice #0: Subdevice #0
Subdevice #1: Subdevice #1
Card 2:cloverviewaudio [Cloverview_audio], device 1:voice rt5640-aif2-1 []
Subdevices:1/1
Subdevice #0: Subdevice #0
Card 2:cloverviewaudio [Cloverview_audio], device 3:btsco snd-soc-dummy-dai-3 []
Subdevices:1/1
Subdevice #0: Subdevice #0
Card 2:cloverviewaudio [Cloverview_audio], device 4:voip rt5640-aif2-4 []
Subdevices:1/1
Subdevice #0: Subdevice #0
Card 2:cloverviewaudio [Cloverview_audio], device 5:ifx_modem_mixing snd-soc-dummy-dai-5 []
Subdevices:1/1
Subdevice #0: Subdevice #0
Card 2:cloverviewaudio [Cloverview_audio], device 6:virtual-stream rt5640-aif1-6 []
Subdevices:1/1
Subdevice #0: Subdevice #0
Card 2:cloverviewaudio [Cloverview_audio], device 7:CTP Probe snd-soc-dummy-dai-7 []
Subdevices:1/1
Subdevice #0: Subdevice #0

Because my codec is alc5640, so
Learned from the above alc5640 hanging on the card2, so we will be configured Amixer 5640 when the-C 2 is right.

2. Usage of alsa_amixer

Alsa_amixer-h//The same help, not listed here.

The use of alc5640 for mixer control:

# alsa_amixer-c 2 Controls

As follows:

Alsa_amixer-c 2 Controls
Numid=35,iface=mixer,name= ' Headphone Switch '
Numid=20,iface=mixer,name= ' Mono ADC Capture Volume '
Numid=122,iface=mixer,name= ' Mono ADC L1 Mux '
Numid=123,iface=mixer,name= ' Mono ADC L2 Mux '
Numid=114,iface=mixer,name= ' Mono ADC mixl ADC1 Switch '
Numid=115,iface=mixer,name= ' Mono ADC mixl ADC2 Switch '
Numid=112,iface=mixer,name= ' Mono ADC mixr ADC1 Switch '
Numid=113,iface=mixer,name= ' Mono ADC mixr ADC2 Switch '
Numid=121,iface=mixer,name= ' Mono ADC R1 Mux '
Numid=120,iface=mixer,name= ' Mono ADC R2 Mux '
Numid=93,iface=mixer,name= ' Mono DAC MIXL DAC L1 Switch '
Numid=94,iface=mixer,name= ' Mono DAC MIXL DAC L2 Switch '
Numid=95,iface=mixer,name= ' Mono DAC MIXL DAC R2 Switch '
Numid=92,iface=mixer,name= ' Mono DAC mixr DAC L2 Switch '
Numid=90,iface=mixer,name= ' Mono DAC mixr DAC R1 Switch '
Numid=91,iface=mixer,name= ' Mono DAC mixr DAC R2 Switch '
Numid=11,iface=mixer,name= ' Mono DAC Playback Volume '
Numid=44,iface=mixer,name= ' Mono MIX BST1 Switch '
Numid=41,iface=mixer,name= ' Mono MIX DAC L2 Switch '
Numid=40,iface=mixer,name= ' Mono MIX DAC R2 Switch '
Numid=43,iface=mixer,name= ' Mono MIX outvol L Switch '
Numid=42,iface=mixer,name= ' Mono MIX outvol R Switch '
Numid=85,iface=mixer,name= ' Mono dacr Mux '
Numid=8,iface=mixer,name= ' Mono Playback Switch '
Numid=21,iface=mixer,name= ' ADC Boost Gain '
Numid=24,iface=mixer,name= ' ADC IF1 Data Switch '
Numid=26,iface=mixer,name= ' ADC IF2 Data Switch '
Numid=18,iface=mixer,name= ' ADC Capture Switch '
Numid=19,iface=mixer,name= ' ADC Capture Volume '
Numid=22,iface=mixer,name= ' Class D SPK Ratio Control '
Numid=25,iface=mixer,name= ' DAC IF1 Data Switch '
Numid=27,iface=mixer,name= ' DAC IF2 Data Switch '
Numid=103,iface=mixer,name= ' DAC L2 Mux '
Numid=107,iface=mixer,name= ' DAC mixl INF1 Switch '
Numid=106,iface=mixer,name= ' DAC mixl Stereo ADC Switch '
Numid=105,iface=mixer,name= ' DAC mixr INF1 Switch '
Numid=104,iface=mixer,name= ' DAC mixr Stereo ADC Switch '
Numid=102,iface=mixer,name= ' DAC R2 Mux '
Numid=10,iface=mixer,name= ' DAC1 Playback Volume '
Numid=9,iface=mixer,name= ' DAC2 Playback Switch '
Numid=108,iface=mixer,name= ' DAI select '
Numid=88,iface=mixer,name= ' DIG mixl DAC L1 Switch '
Numid=89,iface=mixer,name= ' DIG mixl DAC L2 Switch '
Numid=86,iface=mixer,name= ' DIG mixr DAC R1 Switch '
Numid=87,iface=mixer,name= ' DIG mixr DAC R2 Switch '
Numid=23,iface=mixer,name= ' DMIC Switch '
Numid=37,iface=mixer,name= ' Ext Spk L Switch '
Numid=38,iface=mixer,name= ' Ext Spk R Switch '
Numid=3,iface=mixer,name= ' HP Playback Switch '
Numid=4,iface=mixer,name= ' HP Playback Volume '
Numid=50,iface=mixer,name= ' HPO MIX DAC1 Switch '
Numid=49,iface=mixer,name= ' HPO MIX DAC2 Switch '
Numid=51,iface=mixer,name= ' HPO MIX hpvol Switch '
Numid=36,iface=mixer,name= ' Headset Mic Switch '
Numid=111,iface=mixer,name= ' IF2 ADC L Mux '
Numid=110,iface=mixer,name= ' IF2 ADC R Mux '
Numid=17,iface=mixer,name= ' in Capture Volume '
Numid=13,iface=mixer,name= ' IN1 Boost '
Numid=12,iface=mixer,name= ' IN1 Mode Control '
Numid=15,iface=mixer,name= ' IN2 Boost '
Numid=14,iface=mixer,name= ' IN2 Mode Control '
Numid=39,iface=mixer,name= ' Int Mic Switch '
Numid=45,iface=mixer,name= ' LOUT MIX DAC L1 Switch '
Numid=46,iface=mixer,name= ' LOUT MIX DAC R1 Switch '
Numid=47,iface=mixer,name= ' LOUT MIX outvol L Switch '
Numid=48,iface=mixer,name= ' LOUT MIX outvol R Switch '
Numid=29,iface=mixer,name= ' LPE IHF MIXER '
Numid=30,iface=mixer,name= ' LPE headset MIXER '
Numid=6,iface=mixer,name= ' Out Channel Switch '
Numid=69,iface=mixer,name= ' out MIXL BST1 Switch '
Numid=68,iface=mixer,name= ' out MIXL BST3 Switch '
Numid=74,iface=mixer,name= ' out MIXL DAC L1 Switch '
Numid=73,iface=mixer,name= ' out MIXL DAC L2 Switch '
Numid=72,iface=mixer,name= ' out MIXL DAC R2 Switch '
Numid=70,iface=mixer,name= ' out MIXL INL Switch '
Numid=71,iface=mixer,name= ' out MIXL REC mixl Switch '
Numid=62,iface=mixer,name= ' out mixr BST1 Switch '
Numid=61,iface=mixer,name= ' out mixr BST2 Switch '
Numid=60,iface=mixer,name= ' out mixr BST3 Switch '
Numid=65,iface=mixer,name= ' out mixr DAC L2 Switch '
Numid=67,iface=mixer,name= ' out mixr DAC R1 Switch '
Numid=66,iface=mixer,name= ' out mixr DAC R2 Switch '
Numid=63,iface=mixer,name= ' out mixr INR Switch '
Numid=64,iface=mixer,name= ' out mixr REC mixr Switch '
Numid=5,iface=mixer,name= ' Out Playback Switch '
Numid=7,iface=mixer,name= ' Out Playback Volume '
Numid=138,iface=mixer,name= ' RECMIXL BST1 Switch '
Numid=137,iface=mixer,name= ' RECMIXL BST2 Switch '
Numid=136,iface=mixer,name= ' RECMIXL BST3 Switch '
Numid=134,iface=mixer,name= ' RECMIXL Hpol Switch '
Numid=135,iface=mixer,name= ' RECMIXL INL Switch '
Numid=139,iface=mixer,name= ' RECMIXL out MIXL Switch '
Numid=132,iface=mixer,name= ' Recmixr BST1 Switch '
Numid=131,iface=mixer,name= ' Recmixr BST2 Switch '
Numid=130,iface=mixer,name= ' Recmixr BST3 Switch '
Numid=128,iface=mixer,name= ' Recmixr hpor Switch '
Numid=129,iface=mixer,name= ' Recmixr INR Switch '
Numid=133,iface=mixer,name= ' recmixr out MIXR Switch '
Numid=28,iface=mixer,name= ' Register Control '
Numid=109,iface=mixer,name= ' SDI select '
Numid=82,iface=mixer,name= ' SPK mixl DAC L1 Switch '
Numid=83,iface=mixer,name= ' SPK mixl DAC L2 Switch '
Numid=81,iface=mixer,name= ' SPK mixl INL Switch '
Numid=84,iface=mixer,name= ' SPK mixl out MIXL Switch '
Numid=80,iface=mixer,name= ' SPK mixl REC mixl Switch '
Numid=77,iface=mixer,name= ' SPK mixr DAC R1 Switch '
Numid=78,iface=mixer,name= ' SPK mixr DAC R2 Switch '
Numid=76,iface=mixer,name= ' SPK mixr INR Switch '
Numid=79,iface=mixer,name= ' SPK mixr out MIXR Switch '
Numid=75,iface=mixer,name= ' SPK mixr REC mixr Switch '
Numid=59,iface=mixer,name= ' Spol MIX BST1 Switch '
Numid=56,iface=mixer,name= ' Spol MIX DAC L1 Switch '
Numid=55,iface=mixer,name= ' Spol MIX DAC R1 Switch '
Numid=58,iface=mixer,name= ' Spol MIX spkvol L Switch '
Numid=57,iface=mixer,name= ' Spol MIX spkvol R Switch '
Numid=54,iface=mixer,name= ' Spor MIX BST1 Switch '
Numid=52,iface=mixer,name= ' Spor MIX DAC R1 Switch '
Numid=53,iface=mixer,name= ' Spor MIX spkvol R Switch '
Numid=32,iface=mixer,name= ' SSP BT Master Mode '
Numid=34,iface=mixer,name= ' SSP Modem Master Mode '
Numid=33,iface=mixer,name= ' SSP VOIP Master Mode '
Numid=31,iface=mixer,name= ' SST Probe Byte Control '
Numid=16,iface=mixer,name= ' Speaker Boost '
Numid=1,iface=mixer,name= ' Speaker Playback Switch '
Numid=2,iface=mixer,name= ' Speaker Playback Volume '
Numid=125,iface=mixer,name= ' Stereo ADC L1 Mux '
Numid=127,iface=mixer,name= ' Stereo ADC L2 Mux '
Numid=118,iface=mixer,name= ' Stereo ADC mixl ADC1 Switch '
Numid=119,iface=mixer,name= ' Stereo ADC mixl ADC2 Switch '
Numid=116,iface=mixer,name= ' Stereo ADC mixr ADC1 Switch '
Numid=117,iface=mixer,name= ' Stereo ADC mixr ADC2 Switch '
Numid=124,iface=mixer,name= ' Stereo ADC R1 Mux '
Numid=126,iface=mixer,name= ' Stereo ADC R2 Mux '
Numid=101,iface=mixer,name= ' Stereo DAC mixl ANC Switch '
Numid=99,iface=mixer,name= ' Stereo DAC MIXL DAC L1 Switch '
Numid=100,iface=mixer,name= ' Stereo DAC MIXL DAC L2 Switch '
Numid=98,iface=mixer,name= ' Stereo DAC mixr ANC Switch '
Numid=96,iface=mixer,name= ' Stereo DAC mixr DAC R1 Switch '
Numid=97,iface=mixer,name= ' Stereo DAC mixr DAC R2 Switch '

Alsa_amixer-c 2 cget numid=2//Get the main speaker's volume from Card2

Alsa_amixer-c 2 Cset numid=2 39//Set the volume of the main speaker from the Card2 =39
Alsa_amixer-c 2 Cset numid=2 100%//Set the volume of the main speaker from the Card2 =39

You can read it. Embedded linux/android alsa_aplay alsa_amixer command line usage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.