在线音频转换,奈何公司的网速太慢,一个mp3 转换成的wav 的大小几乎会达到12M

其实sox可以很无脑的完成这些操作
sox 1.mp3 1.wav
sox 1.mp3 1.ogg
sox几乎支持所有的音频操作~~~~

amixer 是alsa的命令行工具,对于声卡的参数的配置.

主要命令是

amixer contents 是操作的详细介绍
amixer controls 是操作的一般介绍
amixer controls 
numid=33,iface=CARD,name='Front Headphone Jack'
numid=29,iface=CARD,name='Front Mic Jack'
numid=31,iface=CARD,name='Line Jack'
numid=32,iface=CARD,name='Line Out Jack'
numid=30,iface=CARD,name='Rear Mic Jack'
numid=28,iface=MIXER,name='Master Playback Switch'
numid=27,iface=MIXER,name='Master Playback Volume'
numid=10,iface=MIXER,name='Headphone Playback Switch'
numid=37,iface=MIXER,name='PCM Playback Volume'
numid=25,iface=MIXER,name='Front Mic Boost Volume'
numid=13,iface=MIXER,name='Front Mic Playback Switch'
numid=12,iface=MIXER,name='Front Mic Playback Volume'
numid=3,iface=MIXER,name='Front Playback Switch'
numid=2,iface=MIXER,name='Front Playback Volume'
numid=5,iface=MIXER,name='Surround Playback Switch'
numid=4,iface=MIXER,name='Surround Playback Volume'
numid=8,iface=MIXER,name='Center Playback Switch'
numid=6,iface=MIXER,name='Center Playback Volume'
numid=9,iface=MIXER,name='LFE Playback Switch'
numid=7,iface=MIXER,name='LFE Playback Volume'
numid=17,iface=MIXER,name='Line Playback Switch'
numid=16,iface=MIXER,name='Line Playback Volume'
numid=22,iface=MIXER,name='Capture Switch'
numid=24,iface=MIXER,name='Capture Switch',index=1
numid=21,iface=MIXER,name='Capture Volume'
numid=23,iface=MIXER,name='Capture Volume',index=1
numid=11,iface=MIXER,name='Loopback Mixing'
numid=18,iface=MIXER,name='Auto-Mute Mode'
numid=1,iface=MIXER,name='Channel Mode'
numid=38,iface=MIXER,name='Digital Capture Volume'
numid=19,iface=MIXER,name='Input Source'
numid=20,iface=MIXER,name='Input Source',index=1
numid=26,iface=MIXER,name='Rear Mic Boost Volume'
numid=15,iface=MIXER,name='Rear Mic Playback Switch'
numid=14,iface=MIXER,name='Rear Mic Playback Volume'
numid=35,iface=PCM,name='Capture Channel Map'
numid=34,iface=PCM,name='Playback Channel Map'
numid=36,iface=PCM,name='Capture Channel Map',device=2


amixer contents
numid=33,iface=CARD,name='Front Headphone Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=on
numid=29,iface=CARD,name='Front Mic Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=31,iface=CARD,name='Line Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=32,iface=CARD,name='Line Out Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=30,iface=CARD,name='Rear Mic Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=28,iface=MIXER,name='Master Playback Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
numid=27,iface=MIXER,name='Master Playback Volume'
  ; type=INTEGER,access=rw---R--,values=1,min=0,max=64,step=0
  : values=29
  | dBscale-min=-64.00dB,step=1.00dB,mute=0
numid=10,iface=MIXER,name='Headphone Playback Switch'
  ; type=BOOLEAN,access=rw------,values=2
  : values=on,on
numid=37,iface=MIXER,name='PCM Playback Volume'
  ; type=INTEGER,access=rw---RW-,values=2,min=0,max=255,step=0
  : values=255,255
  | dBscale-min=-51.00dB,step=0.20dB,mute=0
numid=25,iface=MIXER,name='Front Mic Boost Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=3,step=0
  : values=3,3
  | dBscale-min=0.00dB,step=10.00dB,mute=0
numid=13,iface=MIXER,name='Front Mic Playback Switch'
  ; type=BOOLEAN,access=rw------,values=2
  : values=off,off
numid=12,iface=MIXER,name='Front Mic Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=31,step=0
  : values=31,31
  | dBscale-min=-34.50dB,step=1.50dB,mute=0
numid=3,iface=MIXER,name='Front Playback Switch'
  ; type=BOOLEAN,access=rw------,values=2
  : values=on,on
numid=2,iface=MIXER,name='Front Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=64,step=0
  : values=64,64
  | dBscale-min=-64.00dB,step=1.00dB,mute=0
numid=5,iface=MIXER,name='Surround Playback Switch'
  ; type=BOOLEAN,access=rw------,values=2
  : values=off,off
numid=4,iface=MIXER,name='Surround Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=64,step=0
  : values=64,64
  | dBscale-min=-64.00dB,step=1.00dB,mute=0
numid=8,iface=MIXER,name='Center Playback Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
numid=6,iface=MIXER,name='Center Playback Volume'
  ; type=INTEGER,access=rw---R--,values=1,min=0,max=64,step=0
  : values=64
  | dBscale-min=-64.00dB,step=1.00dB,mute=0
numid=9,iface=MIXER,name='LFE Playback Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
numid=7,iface=MIXER,name='LFE Playback Volume'
  ; type=INTEGER,access=rw---R--,values=1,min=0,max=64,step=0
  : values=64
  | dBscale-min=-64.00dB,step=1.00dB,mute=0
numid=17,iface=MIXER,name='Line Playback Switch'
  ; type=BOOLEAN,access=rw------,values=2
  : values=off,off
numid=16,iface=MIXER,name='Line Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=31,step=0
  : values=31,31
  | dBscale-min=-34.50dB,step=1.50dB,mute=0
numid=22,iface=MIXER,name='Capture Switch'
  ; type=BOOLEAN,access=rw------,values=2
  : values=on,on
numid=24,iface=MIXER,name='Capture Switch',index=1
  ; type=BOOLEAN,access=rw------,values=2
  : values=off,off
numid=21,iface=MIXER,name='Capture Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=31,step=0
  : values=31,31
  | dBscale-min=-13.50dB,step=1.50dB,mute=0
numid=23,iface=MIXER,name='Capture Volume',index=1
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=31,step=0
  : values=0,0
  | dBscale-min=-13.50dB,step=1.50dB,mute=0
numid=11,iface=MIXER,name='Loopback Mixing'
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 'Disabled'
  ; Item #1 'Enabled'
  : values=1
numid=18,iface=MIXER,name='Auto-Mute Mode'
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 'Disabled'
  ; Item #1 'Enabled'
  : values=1
numid=1,iface=MIXER,name='Channel Mode'
  ; type=ENUMERATED,access=rw------,values=1,items=3
  ; Item #0 '2ch'
  ; Item #1 '4ch'
  ; Item #2 '6ch'
  : values=0
numid=38,iface=MIXER,name='Digital Capture Volume'
  ; type=INTEGER,access=rw---RW-,values=2,min=0,max=120,step=0
  : values=60,60
  | dBscale-min=-30.00dB,step=0.50dB,mute=0
numid=19,iface=MIXER,name='Input Source'
  ; type=ENUMERATED,access=rw------,values=1,items=3
  ; Item #0 'Front Mic'
  ; Item #1 'Rear Mic'
  ; Item #2 'Line'
  : values=0
numid=20,iface=MIXER,name='Input Source',index=1
  ; type=ENUMERATED,access=rw------,values=1,items=3
  ; Item #0 'Front Mic'
  ; Item #1 'Rear Mic'
  ; Item #2 'Line'
  : values=0
numid=26,iface=MIXER,name='Rear Mic Boost Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=3,step=0
  : values=0,0
  | dBscale-min=0.00dB,step=10.00dB,mute=0
numid=15,iface=MIXER,name='Rear Mic Playback Switch'
  ; type=BOOLEAN,access=rw------,values=2
  : values=off,off
numid=14,iface=MIXER,name='Rear Mic Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=31,step=0
  : values=31,31
  | dBscale-min=-34.50dB,step=1.50dB,mute=0
numid=35,iface=PCM,name='Capture Channel Map'
  ; type=INTEGER,access=r----R--,values=2,min=0,max=36,step=0
  : values=0,0
  | container
    | chmap-fixed=FL,FR

numid=34,iface=PCM,name='Playback Channel Map'
  ; type=INTEGER,access=r----R--,values=2,min=0,max=36,step=0
  : values=3,4
  | container
    | chmap-fixed=FL,FR

numid=36,iface=PCM,name='Capture Channel Map',device=2
  ; type=INTEGER,access=r----R--,values=2,min=0,max=36,step=0
  : values=0,0
  | container
    | chmap-fixed=FL,FR


比如
numid=27,iface=MIXER,name='Master Playback Volume'
  ; type=INTEGER,access=rw---R--,values=1,min=0,max=64,step=0
  : values=29
  | dBscale-min=-64.00dB,step=1.00dB,mute=0

命令 amixer cset numid=27 :0 
表示的是对音频不做处理的放大. 也就是放大0db
具体的db我忘了.......
命令对与那种bool 类型的是就是
amixer cset numid=x 1   或者是0 


card 0: SOUND0 [TI81XX SOUND0], device 1: AIC3X tlv320aic3x-hifi-1 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: SOUND1 [TI81XX SOUND1], device 0: hdmi HDMI-DAI-CODEC-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
-D参数用于指定音频设备PCM
以hwx,x开头
根据上面l列出的设备,如果选择tlv320aic3x来播放声音的话那么pcm设备就位hw0,1,如果是hdmi则pcm设备为hw0,0。
声卡号,设备号
-r指定采样频率:5512/8000/11025/16000/22050/32000/44100/48000/64000/88200/96000/176400/192000
-f指定采样格式上面列出了:cd/cdr/dat
 
完整的播放例子:
[cpp]
aplay -Dhw:0,1 -r8000 -f cd /a/1.wmv 
aplay -Dhw:0,1 -r8000 -f cd /a/1.wmv

上面的例子必须先录制在播放,如果想要一边播放一边收听可以用下面利用管道的命令
[cpp]
arecord -Dhw:0,1 -r192000 -f cd|aplay -Dhw:0,1 -r192000 
arecord -Dhw:0,1 -r192000 -f cd|aplay -Dhw:0,1 -r192000


基于com的pin管教代码:
/sys/class/gpio# echo 12 > export 
对应的管教
cat value 
echo in > direction
输入方向
脚本就可以实现很方便的控制了.

参考:
http://blog.csdn.net/samssm/article/details/53157206

posted on 2017-11-17 19:41  HDU李少帅  阅读(2391)  评论(0编辑  收藏  举报