tinycap:根据已接入声卡设备推断tinycap命令

tinycap命令能够录音不代表能正确录到音频

获取系统声卡设备列表

cat /proc/asound/pcm 

可以获取到类似于以下格式的内容

00-00: mt85xx PCM : mtk PCM_0 : playback 2 : capture 2
00-01: mt85xx PCM : mtk PCM_1 : playback 2 : capture 2
00-02: mt85xx PCM : mtk PCM_2 : playback 2 : capture 2
00-03: mt85xx PCM : mtk tunel_pcm : playback 2 : capture 2
00-04: mt85xx PCM : mtk tunel_ac3 : playback 2 : capture 2
00-05: mt85xx PCM : mtk non_tunel_ac3 : playback 2 : capture 2
01-00: mt85xx PCM : mtk PCM_0 : playback 2 : capture 2
02-00: USB Audio : USB Audio : capture 1

获取指定声卡详细信息

可根据系统声卡设备列表,来选择查看对应声卡设备,如03-00: USB Audio : USB Audio : capture 1前边设备序号为03,则可以使用以下命令获取声卡设备信息:

tinypcminfo -D 2

—>

Info for card 2, device 0:

PCM out:
cannot open device '/dev/snd/pcmC3D0p' 2  retry_fn_count: 0
cannot open device fn /dev/snd/pcmC3D0p  2
cannot open device '/dev/snd/pcmC3D0p' 2  retry_fn_count: 1
cannot open device fn /dev/snd/pcmC3D0p  2
cannot open device '/dev/snd/pcmC3D0p' 2  retry_fn_count: 2
cannot open device fn /dev/snd/pcmC3D0p  2
cannot open device '/dev/snd/pcmC3D0p' 2  retry_fn_count: 3
cannot open device fn /dev/snd/pcmC3D0p  2
cannot open device '/dev/snd/pcmC3D0p' 2  retry_fn_count: 4
cannot open device fn /dev/snd/pcmC3D0p  2
Device does not exist.

PCM in:
      Access:   0x000009
   Format[0]:   0x000004
   Format[1]:   00000000
 Format Name:   S16_LE
   Subformat:   0x000001
        Rate:   min=16000Hz     max=16000Hz
    Channels:   min=8           max=8
 Sample bits:   min=16          max=16
 Period size:   min=16          max=32768
Period count:   min=2           max=1024

根据PCM in的信息,可以了解到声卡设备所支持的采样率范围Rate、通道信息Channels、采样大小Sample bits

补充

-p参数

一般是采样率乘以0.04(待确认),如640:16000x0.04
有时需要根据传输或硬件相关内容去设置,例如有时-p需要设置为1024

-n参数

一般为6,如果-p大小不是正常计算而来,而是硬性要求大小,则可尝试4或者8,一般不会很大,不然会占用大量内存空间

你可能感兴趣的:(音频)