如何将 16 位 wav 转换为原始音频 [英] How to convert 16bit wav to raw audio
问题描述
我正在尝试使用 sox 将星号语音邮件转换为原始音频.原始 wav 的编码信息是 PCM S16 LE,所以我以为我只能做 sox msg0000.wav msg0001.raw
但原始文件是乱码,根据 VLC,与 6 秒的源文件相比,时长为 4 分钟.
I'm trying to use sox to convert asterisk voicemails to raw audio. The encoding information of the original wav is PCM S16 LE, so I thought I would just be able to do sox msg0000.wav msg0001.raw
but the raw file from that is garbled and, according to VLC, 4 minutes long, compared to a 6 second source file.
我不确定我哪里出错了,有人知道如何将 wav 转换为原始格式吗?最好使用 sox,但任何命令行解决方案都可以.
I'm not sure where I'm going wrong, anybody how to convert a wav to raw? Preferably using sox, but any commandline solution will do fine.
推荐答案
您确定您的问题出在 sox 而不是 VLC?我也遇到了让 VLC 播放原始音频的问题.有命令行选项,但我并没有完全让它们工作.
Are you sure that your problem is with sox and not VLC? I've also had problems getting VLC to play raw audio. There are command-line options but I didn't quite get them to work.
在寻找其他工具之前,通过尝试类似的方法来验证 sox 确实是问题
Before looking for another tool, verify that sox is indeed the problem by trying something like
mplayer -rawaudio samplesize=2:channels=1:rate=8000 -demuxer rawaudio msg0001.raw
此外,可以为 sox 提供其他选项:
Also, sox can be given additional options:
sox msg0000.wav --bits 16 --encoding signed-integer --endian little msg0001.raw
但我怀疑这些是默认设置,因此不需要它们.
But I suspect that these are the default settings, so they shouldn't be needed.
这篇关于如何将 16 位 wav 转换为原始音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!