And*_*ang 5 speech-recognition audio-recording raspberry-pi raspbian
我正在使用SpeechRecognition包进行文本转语音。然而,它的 WAV 文件输入必须是单声道。当我使用arecord -D plughw:0 --duration=5 -f cd -vv ~/test.wav并使用它播放时aplay test.wav,我得到(它播放):
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Run Code Online (Sandbox Code Playgroud)
如何以arecord单声道录音?我也尝试添加--channels=1,但当它开始记录并显示有关其 ( Plug PCM: Route conversion PCM) 设置的信息时,它总是显示:
...
channels : 2
...
Run Code Online (Sandbox Code Playgroud)
我USB PnP Sound Device的设置显示通道为 1。即使我将其设置为 1,它也以立体声播放。怎么了?
你的问题很奇怪,但我通常使用 sox 进行录制或转换
可以使用rec命令直接录制:
rec -r 16000 -c 1 -d 5 ~/test.wav
在这种情况下,另请参阅这个问题:https://raspberrypi.stackexchange.com/questions/4715/sox-alsa-sound-recording-issue
或者您可以将 wav 文件从立体声转换为单声道:sox ~/test.wav -c 1 ~/test_mono.wav
文档和示例: http: //linux.die.net/man/1/sox