Windows 的 SoX 命令

SoX commands for Windows

我有这些 SoX 命令可以在 Linux 上运行,但不能在 Windows 上运行,因为 Windows 版本没有随 playrec 一起提供了。我如何修改这些以仅使用 sox?

rec -c 1 -r 48k -q -n noiseprof - trim 0 5
rec -c 1 -r 48k -q -t flac - noisered - 0.21 silence -l 1 0.0 1% 1 3.0 5% pad 1 0
play -t mp3 - -q

我在 Python 中使用它们进行语音识别,并希望使用这样的语句

sox = shutil.which('sox') or glob.glob('C:\Program Files*\sox*\sox.exe')[0]

让它独立于平台。

摘自六本手册:

The play and rec commands are provided so that basic playing and recording is as simple as

play existing-file.wav

and

rec new-file.wav

These two commands are functionally equivalent to

sox existing-file.wav -d

and

sox -d new-file.wav

-d 选项表示 select 输入(如果它先出现)或输出(如果它最后出现)的默认音频设备。