如何使用arecord录音

arecord 是ALSA声卡驱动程序的命令行声音文件记录器。 它支持多种文件格式和具有多个设备的多个声卡。 如果以交错模式录制,文件将在2GB文件大小之前自动分割。

使用前先查看 arecord 的帮助信息:

[root@imx6ull:~]# arecord -h

Usage: arecord [OPTION]... [FILE]...

-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

-s, --samples=# interrupt after # samples per channel

-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 is # 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

-i, --interactive allow interactive operation from stdin

-m, --chmap=ch1,ch2,.. Give the channel map to override or follow

--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 coefficient 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

--dump-hw-params dump hw_params of the device

--fatal-errors treat all errors as fatal

Recognized sample formats are: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW A_LAW IMA_ADPCM MPEG GSM SPECIAL S24_3LE S24_3BE U24_3LE U24_3BE S20_3LE S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE U18_3BE G723_24 G723_24_1B G723_40 G723_40_1B DSD_U8 DSD_U16_LE DSD_U32_LE DSD_U16_BE DSD_U32_BE

Some of these may not be available on selected hardware

The available format shortcuts are:

-f cd (16 bit little endian, 44100, stereo)

-f cdr (16 bit big endian, 44100, stereo)

-f dat (16 bit little endian, 48000, stereo)

根据帮助信息可知:

使用 arecord -l 命令列出声卡和数字音频设备:

[root@imx6ull:~]# arecord -l

**** List of CAPTURE Hardware Devices ****

card 0: wm8960audio [wm8960-audio], device 0: HiFi wm8960-hifi-0 []

Subdevices: 1/1

Subdevice #0: subdevice #0

card 0: wm8960audio [wm8960-audio], device 1: HiFi-ASRC-FE (*) []

Subdevices: 1/1

Subdevice #0: subdevice #0

得到声卡和数字音频设备列表后,可根据其信息进行以下操作:

-d 指定录音时间(秒)

-D 参数用于指定音频设备 PCM

以 hwx,x 开头(声卡号,设备号)

根据上面列出的设备,如果选择 HiFi wm8960-hifi-0 来录制声音的话那么 pcm 设备就为 hw0,0,如果是 HiFi wm8960-hifi-1 则 pcm 设备为 hw0,1,HiFi wm8960-hifi-2 则 pcm 设备为 hw0,2 ...以此类推。

-r 指定采样频率: 5512/8000/11025/16000/22050/32000/44100/48000/64000/88200/96000/176400/192000

-f 指定采样格式上面的帮助信息列出了: cd/cdr/dat/S16_LE/S32_LE/...

示例:

[root@imx6ull:~]# arecord -D default:CARD=mcasp0 -d 100000 -f cd -t raw duration—100000s_format-cd.raw

[root@imx6ull:~]# arecord -D default:CARD=mcasp0 -d 100000 -f dat -t raw duration—100000s_format-dat.raw

[root@imx6ull:~]# arecord -D default:CARD=mcasp0 -d 100000 -f S16_LE -r 16000 -t raw duration—100000s_format-S16_LE_rate-16000.raw

[root@imx6ull:~]# arecord -Dhw:0,1 -r8000 -f cd test.wmv

[root@imx6ull:~]# arecord -Dhw:0,0 -r8000 -f S16_LE -c 2 test.wmv

[root@imx6ull:~]# arecord -Dhw:0,2 -r48000 -f S32_LE -c 2 test.wmv

linux arecord 命令,如何使用arecord录音相关推荐

  1. 最牛B 的 Linux Shell 命令

    最牛B 的 Linux Shell 命令(一) 引言 Shell作为Unix系操作系统当中最有魅力且不可或缺的组件,经过数十载的洗礼不仅没有被淘汰,而且愈加变得成熟稳健,究其原因,大概因为它是个非常稳 ...

  2. 常用的高级Linux shell命令

    编者按本文编译自commandlinefu.com的系列文章To p Ten One-Liners from CommandLineFu Explained.作为一个由用户推荐最有用shell命令的网 ...

  3. 最牛B的Linux Shell命令 系列

    编者按 本文编译自commandlinefu.com的系列文章Top Ten One-Liners from CommandLineFu Explained.作为一个由用户推荐最有用shell命令的网 ...

  4. Linux系统设置命令大全

    1.reset命令 Linux reset命令其实和 tset 是一同个命令,它的用途是设定终端机的状态.一般而言,这个命令会自动的从环境变数.命令列或是其它的组态档决定目前终端机的型态.如果指定型态 ...

  5. linux常用命令(转载)

    Linux常用命令大全(非常全!!!) 最近都在和Linux打交道,感觉还不错.我觉得Linux相比windows比较麻烦的就是很多东西都要用命令来控制,当然,这也是很多人喜欢linux的原因,比较短 ...

  6. linux if 命令判断条件总结

    linux if命令 关于文件属性的判断式 -a 如果文件存在 -b 如果文件存在,且该文件是区域设备文件 -c 当file存在并且是字符设备文件时返回真 -d 当pathname存在并且是一个目录时 ...

  7. linux paste变量,Linux paste命令详解

     Linux 命令大全 小白告诉你:Linux paste 命令用于合并文件的列. paste 指令会把每个文件以列对列的方式,一列列地加以合并. 语法 paste [-s][-d ][--help] ...

  8. linux unset命令,Linux unset命令

    Linux unset命令 Linux unset命令用于删除变量或函数. unset为shell内建指令,可删除变量或函数. 语法unset [-fv][变量或函数名称] 参数:-f 仅删除函数. ...

  9. linux wc 命令简介

    此wc命令不是让大家没有食欲的地方.而是linux下一个简单的小命令. NAME wc - word, line, character, and byte count SYNOPSIS wc [-cl ...

最新文章

  1. deepin安装node,npm
  2. ModBus的小于3.5S间隔的理解
  3. Spring+jpaNo transactional EntityManager available
  4. 一只小蜜蜂(HDU-2044)
  5. no such file or directory什么意思_为什么这次 MySQL 崩溃恢复要这么久-爱可生
  6. Springboot 整合 Netty 实战(附源码)
  7. PBR理论基础1:辐射度与BRDF
  8. Visual Basic 2012 借助DataGridView控件将Excel 2010数据导入到SQL server 2012
  9. NoSQL数据库的介绍、NoSQL的产品、NoSQL数据库的分类等;
  10. 小米8刷原生安卓系统
  11. 管理系列:OKR介绍
  12. 上海驾照科目三练习笔记
  13. Router路由守卫
  14. Python分支+简单循环
  15. 海洋cms播放器html,海洋cms升级新播放器后播放不了如何解决?
  16. 笔记本电脑怎样重装系统
  17. 博途v15安装过程中提示出错_博图v15安装出错
  18. 小游戏算年龄(Java)
  19. 汉诺塔游戏(java)
  20. Outlook.com高级版优惠价截止日顺延到6月30日

热门文章

  1. 刷算法题总结的一些结论公式
  2. 1017 Queueing at Bank (25 分) 【未完成】【难度: 中 / 知识点: 模拟】
  3. python tk 当输入数值错误是报错_Python的异常处理
  4. 单文档应用程序弹出新对话框_简介——文档
  5. window如何传文件到mac_如何将Mac桌面和文档文件夹同步到iCloud
  6. Redis性能问题排查解决手册(值得收藏)
  7. 基于 SpringBoot,来实现MySQL读写分离技术
  8. javascript高精度计算解决方案
  9. Java中native关键字
  10. php 二叉树判断节点的位置,PHP实现判断二叉树是否对称的方法