精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
I have tried to convert pcm files to wav, but keep getting a FAIL format error, no matter how many (or few) options I try. I am wondering what I need to do to get the file handler for pcm files. Installing sox again and updating the terminal did nothing. I know this question has been here before, and here, but sadly, nobody gave an answer that solved the problem.我尝试将pcm文件转换为wav,但是无论我尝试了多少个(或几个)选项,都始终出现FAIL格式错误。我想知道如何获取pcm文件的文件处理程序。再次安装sox并更新终端无济于事。我知道这个问题一直在这里之前,并在这里,但可悲的是,没有人给的是解决了这个问题的答案。
Here's the command I tried:这是我尝试的命令:
sox -t raw -r 44000 --bits 16 −e signed-integer -c 2 -B \ infile.pcm /wav/outfile.wav channels 1
and this is the error it throws:这是它引发的错误:
sox FAIL formats: no handler for file extension `pcm'
The pcm-files have the following properties:pcm文件具有以下属性:
I need it to give me the speech only (so convert from stereo to mono, but only taking the information from the left channel) and in a wav file, so the program I'm using can deal with it.我需要它只给我讲语音(因此从立体声转换为单声道,但仅从左声道获取信息)并在wav文件中,因此我正在使用的程序可以处理它。
Found a solution! Basically, everyone else's suggestion to put -t raw right after the command was wrong, and order does indeed matter. Now, I don't know why the strictness of the option order is never specified in the documentation (and I think I read through all of it, although not in one sitting), but at least this is what worked for me to convert a headerless raw PCM file to wav:找到了解决方案!基本上,其他所有人的建议都是在命令错误之后放-t raw,顺序确实很重要。现在,我不知道为什么在文档中从来没有指定选项顺序的严格性(我想我通读了所有内容,尽管不是一次开会),但是至少这对我来说是可行的无标题的原始PCM文件到WAV:
sox -e signed-integer -b 16 -B -r 44100 -c 2 -t raw infile.pcm wav/outfile.wav remix 1Order of options, files and effects:选项,文件和效果的顺序:
- encoding编码方式
- sample size采样大小
- endianness字节序
- sample rate采样率
- channels通道
- file type文件类型
- infile输入文件
- outfile输出文件
- remix effect, converting from stereo to mono混音效果,从立体声转换为单声道
The remix effect chooses which channel to use (in this case, 1 for left). My stereo infile consists of speech (left=1) and laryngograph recording (right=2), so I didn't want both together in the output.混音效果选择要使用的声道(在这种情况下,左为1)。我的立体声文件包含语音(左= 1)和喉镜录音(右= 2),所以我不希望两者在输出中一起出现。