Sox 格式的流,样本规格为“s16le 1ch 16000Hz”,通道映射为“mono”

Sox 格式的流,样本规格为“s16le 1ch 16000Hz”,通道映射为“mono”

我正在尝试将音频传输到 sox,但收到错误“sox 失败格式:‘-’的输入格式错误:未指定采样率”

parec -d alsa_output.pci-0000_00_1b.0.analog-stereo.monitor  --rate=16000 --channels=1 | sox -t raw - output.wav  silence 1 0.3 0.1% 1 0.3 0.1% : newfile : restart

这是命令的输出

sox FAIL formats: bad input format for  `-': sampling rate was not specified
Opening a recording stream with sample specification 's16le 1ch 16000Hz' and channel map 'mono'.
Connection established.
Stream successfully created.
Buffer metrics: maxlength=4194304, fragsize=64000
Using sample spec 's16le 1ch 16000Hz', channel map 'mono'.
Connected to device alsa_output.pci-0000_00_1b.0.analog-stereo.monitor (index: 0, suspended: no).
write() failed: Broken pipe

答案1

原始流不包含任何有关其格式的元信息,因此您必须告诉 sox:

parec ... | sox -t raw -r 16k -e signed -b 16 -c 1 ...

相关内容