Some useful tips about sox rec

本文介绍了一种使用SOX软件工具包实现VOX(声控录音)的方法。作者详细分享了设置SOX命令参数的经验,包括如何通过试验找到合适的静音检测阈值,并介绍了在Raspberry Pi上配置环境变量的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I’ve spent a lot of time experimenting with SOX to do VOX and have gotten it to work reasonably well. I’ve been using Audacity to view the resultant wave form, and have settled on the following SOX command…

rec snd.wav silence 1 .5 2.85% 1 1.0 3.0% vad gain -n : newfile : restart

This will:

wait until it hears activity above the threshold for a half second, then start recording (silence 1 .5 2.85%)
stop recording when audible activity falls to zero for one second (... 1 1.0 3.0%)
trim off any initial silence up to voice detection (vad)
normalize the gain (gain -n)
store the result into a new file (snd001.wav, snd002.wav)
restart the process

Getting the “silence” numbers correct involved a lot of trial and error, and will depend on ambient noise as well as the sensitivity of your microphone. I’m using the microphone in the Logitech QuickCam IM on a Raspberry Pi through USB.

On a side note, this whole thing complains with the following…

rec FAIL formats: can’t open input `default’: snd_pcm_open error: No such file or directory

… until I created this variable in the environment:

export AUDIODEV=hw:1,0

Again - this involved a lot of experimentation with the values for “silence”, and it WILL need some tweaking for your environment.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值