amixer,aplay,arecord交叉编译及使用

本文介绍了如何交叉编译和使用Linux ALSA命令行工具amixer(控制音频设置)、aplay(播放音频)和arecord(录音)。通过amixer的controls和contents命令来查看和设置音频控制项,使用arecord和aplay指定声卡设备、采样频率和格式进行录音和播放操作。还涉及到交叉编译alsa-lib和alsa-utils的过程。
摘要由CSDN通过智能技术生成

一.amixer用于控制设置 

amixer的帮助提示信息

Usage: amixer <options> [command]

Available options:
  -h,--help       this help
  -c,--card N     select the card
  -D,--device N   select the device, default 'default'
  -d,--debug      debug mode
  -n,--nocheck    do not perform range checking
  -v,--version    print version of this program
  -q,--quiet      be quiet
  -i,--inactive   show also inactive controls
  -a,--abstract L select abstraction level (none or basic)
  -s,--stdin      Read and execute commands from stdin sequentially

Available commands:
  scontrols       show all mixer simple controls
  scontents       show contents of all mixer simple controls (default command)
  sset sID P      set contents for one mixer simple control
  sget sID        get contents for one mixer simple control
  controls        show all controls for given card
  contents        show contents of all controls for given card
  cset cID P      set control contents for one control
  cget cID        get control contents for one control


主要用到的命令参数有

controls:列出控制项

contents:列出控制上下文(也就是控制项和值)

cset cID P:设置控制项值

cget cID:获取设置项值

使用方法:

1.先amixer controls列出所有控制项

numid=1,iface=MIXER,name='PCM Playback Volume'
numid=22,iface=MIXER,name='Line DAC Playback Volume'
numid=20,iface=MIXER,name='Line Line2 Bypass Volume'
numid=21,iface=MIXER,name='Line PGA Bypass Volume'
numid=32,iface=MIXER,name='Line Playback Switch'
numid=25,iface=MIXER,name='Mono DAC Playback Volume'
numid=23,iface=MIXER,name='Mono Line2 Bypass Volume'
numid=66,iface=MIXER,name='Mono Mixer DACL1 Switch'
numid=69,iface=MIXER,name='Mono Mixer DACR1 Switch'
numid=64,iface=MIXER,name='Mono Mixer Line2L Bypass Switch'
numid=67,iface=MIXER,name='Mono Mixer Line2R Bypass Switch'
numid=65,iface=MIXER,name='Mono Mixer PGAL Bypass Switch'
numid=68,iface=MIXER,name='Mono Mixer PGAR Bypass Switch'
numid=24,iface=MIXER,name='Mono PGA Bypass Volume'
numid=33,iface=MIXER,name='Mono Playback Switch'
numid=39,iface=MIXER,name='ADC HPF Cut-off'
numid=36,iface=MIXER,name='AGC Switch'
numid=28,iface=MIXER,name='HP DAC Playback Volume'
numid=26,iface=MIXER,name='HP Line2 Bypass Volume'
numid=27,iface=MIXER,name='HP PGA Bypass Volume'
numid=34,iface=MIXER,name='HP Playback Switch'
numid=31,iface=MIXER,name='HPCOM DAC Playback Volume'
numid=29,iface=MIXER,name='HPCOM Line2 Bypass Volume'
numid=30,iface=MIXER,name='HPCOM PGA Bypass Volume'
numid=35,iface=MIXER,name='HPCOM Playback Switch'
numid=101,iface=MIXER,name='Left DAC Mux'
numid=60,iface=MIXER,name='Left HP Mixer DACL1 Switch'
numid=10,iface=MIXER,name='Left HP Mixer DACR1 Playback Volume'
numid=63,iface=MIXER,name='Left HP Mixer DACR1 Switch'
numid=58,iface=MIXER,name='Left HP Mixer Line2L Bypass Switch'
numid=61,iface=MIXER,name='Left HP Mixer Line2R Bypass Switch'
numid=8,iface=MIXER,name='Left HP Mixer Line2R Bypass Volume'
numid=59,iface=MIXER,name='Left HP Mixer PGAL Bypass Switch'
numid=62,iface=MIXER,name='Left HP Mixer PGAR Bypass Switch'
numid=9,iface=MIXER,name='Left HP Mixer PGAR Bypass Volume'
numid=48,iface=MIXER,name='Left HPCOM Mixer DACL1 Switch'
numid=16,iface=MIXER,name='Left HPCOM Mixer DACR1 Playback Volume'
numid=51,iface=MIXER,name='Left HPCOM Mixer DACR1 Switch'
numid=46,iface=MIXER,name='Left HPCOM Mixer Line2L Bypass Switch'
numid=49,iface=MIXER,name='Left HPCOM Mixer Line2R Bypass Switch'
numid=14,iface=MIXER,name='Left HPCOM Mixer Line2R Bypass Volume'
numid=47,iface=MIXER,name='Left HPCOM Mixer PGAL Bypass Switch'
numid=50,iface=MIXER,name='Left HPCOM Mixer PGAR Bypass Switch'
numid=15,iface=MIXER,name='Left HPCOM Mixer PGAR Bypass Volume'
numid=100,iface=MIXER,name='Left HPCOM Mux'
numid=78,iface=MIXER,name='Left Line Mixer DACL1 Switch'
numid=4,iface=MIXER,name='Left Line Mixer DACR1 Playback Volume'
numid=81,iface=MIXER,name='Left Line Mixer DACR1 Switch'
numid=76,iface=MIXER,name='Left Line Mixer Line2L Bypass Switch'
numid=79,iface=MIXER,name='Left Line Mixer Line2R Bypass Switch'
numid=2,iface=MIXER,name='Left Line Mixer Line2R Bypass Volume'
numid=77,iface=MIXER,name='Left Line Mixer PGAL Bypass Switch'
numid=80,iface=MIXER,name='Left Line Mixer PGAR Bypass Switch'
numid=3,iface=MIXER,name='Left Line Mixer PGAR Bypass Volume'
numid=92,iface=MIXER,name='Left Line1L Mux'
numid=91,iface=MIXER,name='Left Line1R Mux'
numid=90,iface=MIXER,name='Left Line2L Mux'
numid=93,iface=MIXER,name='Left PGA Mixer Line1L Switch'
numid=94,iface=MIXER,name='Left PGA Mixer Line1R Switch'
numid=95,iface=MIXER,name='Left PGA Mixer Line2L Switch'
numid=96,iface=MIXER,name='Left PGA Mixer Mic3L Switch'
numid=97,iface=MIXER,name='Left PGA Mixer Mic3R Switch'
numid=38,iface=MIXER,name='PGA Capture Switch'
numid=37,iface=MIXER,name='PGA Capture Volume'
numid=99,iface=MIXER,name='Right DAC Mux'
numid=13,iface=MIXER,name='Right HP Mixer DACL1 Playback Volume'
numid=54,iface=MIXER,name='Right HP Mixer DACL1 Switch'
numid=57,iface=MIXER,name='Right HP Mixer DACR1 Switch'
numid=52,iface=MIXER,name='Right HP Mixer Line2L Bypass Switch'
numid=11,iface=MIXER,name='Right HP Mixer Line2L Bypass Volume'
numid=55,iface=MIXER,name='Right HP Mixer Line2R Bypass Switch'
numid=53,iface=MIXER,name='Right HP Mixer PGAL Bypass Switch'
numid=12,iface=MIXER,name='Right HP Mixer PGAL Bypass Volume'
numid=56,iface=MIXER,name='Right HP Mixer PGAR Bypass Switch'
numid=19,iface=MIXER,name='Right HPCOM Mixer DACL1 Playback Volume'
numid=42,iface=MIXER,name='Right HPCOM Mixer DACL1 Switch'
numid=45,iface=MIXER,name='Right HPCOM Mixer DACR1 Switch'
numid=40,iface=MIXER,name='Right HPCOM Mixer Line2L Bypass Switch'
numid=17,iface=MIXER,name='Right HPCOM Mixer Line2L Bypass Volume'
numid=43,iface=MIXER,name='Right HPCOM Mixer Line2R Bypass Switch'
numid=41,iface=MIXER,name='Right HPCOM Mixer PGAL Bypass Switch'
numid=18,iface=MIXER,name='Right HPCOM Mixer PGAL Bypass Volume'
numid=44,iface=MIXER,name='Right HPCOM Mixer PGAR Bypass Switch'
numid=98,ifac
  • 2
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值