最近做语音相关的工作,需要录制一些特定采样率和格式的语音,使用了sox命令行工具。比较简单易用,功能还很强大。sox本身是跨平台的,所以,不同平台上都可以方便使用。
相应的usage,放在最后。先记录一下录制的功能,以下面这种格式为例
相应的命令行如下:
rec -b 16 -r 16000 -c 1 filename.wav
其中,-b
是sample format,-r
是采样率,-c
是channels,1是mono,2是stereo
在命令行环境播放,也很简单。
play filename.wav
详细的参数信息:
Usage summary: [gopts] [[fopts] infile]... [fopts] outfile [effect [effopt]]...
SPECIAL FILENAMES (infile, outfile):
- Pipe/redirect input/output (stdin/stdout); may need -t
-d, --default-device Use the default audio device (where available)
-n, --null Use the `null'