How to convert 16bit wav to raw audio
Asked Answered
P

1

5

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.

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.

Peloquin answered 21/2, 2012 at 19:8 Comment(0)
D
9

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.

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

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.

Discant answered 21/2, 2012 at 20:34 Comment(2)
You were spot on, the phone that I was testing playback on required a 8 bit ulaw file, which I did not find out until I dove into the documentation for it. VLC failed to play it and when the phone also failed I assumed a mal-formed file. Thanks for the help.Peloquin
ffmpeg can also do that.Slimsy

© 2022 - 2024 — McMap. All rights reserved.