How can I play raw PCM file that I dumped from a codec?
Asked Answered
T

1

9

I'm debugging an audio codec and need to test if the data is coming out of a codec properly. I have my code dumping the raw pcm stream into a file and now I want to try to play it in VLC or another OS X compatible player. I've heard that this is possible with VLC from the command line.

Tintype answered 27/1, 2015 at 15:57 Comment(0)
M
15

Short of writing some code to output your own header followed by your PCM data which will of course work - you could use Audacity to import the file as RAW data where you then specify :

Encoding : signed 16 bit PCM
Byte order : little endian (typically unless you're on powerpc or such)
Channels : 1 mono
start offset : 0
sample rate 44100 Hz (typical)

once imported Audacity will let you play the clip ... not as slick as some command line but easy to do none the less

this also works

ffplay  -autoexit -f s16le  myrawaudio.pcm  

above assumes your raw audio is using bit depth of 16 bits which is typical of CD quality audio

Monkeypot answered 29/1, 2015 at 4:6 Comment(1)
This is incredibly convenient for playing back the raw PCM output of Android's AudioRecord API. Thanks!Matrass

© 2022 - 2024 — McMap. All rights reserved.