apply for .pcm file as sox

青春壹個敷衍的年華 提交于 2019-12-23 05:28:16

问题


I want to exchange 16kHz pcm --> 48kHz wav using sox. however, pcm file isn't applied in sox.

so, I just changed pcm to raw, and then sox -r 16000 -e signed -b 16 -c 1 test.raw -r 48000 out.wav

Can I apply for pcm file not convert raw?


回答1:


For the PCM file, since PCM's are headerless, you need to add '-t raw' as the first argument.

sox -t raw -r 16000 -e signed -b 16 -c 1 test.raw -r 48000 out.wav

Try that out.

Also try the different Endian settings; -L; -B; -x though only use one at a time, and only if not using one doesn't work.




回答2:


There is no need to convert the input file into raw. Sox can handle pcm files.

sox input.pcm -r 48000 output.wav

The input file can either be a .pcm or .wav.

Since .wav files have a header containing audio metadata (such as sample rate, bit precision, file length, etc), you don't have to pass any information about the input file. Hence, non need to use:

-r 16000 -e signed -b 16 -c 1

Converting pcm to raw you have just stripped down the file header.



来源:https://stackoverflow.com/questions/22934432/apply-for-pcm-file-as-sox

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!