Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 362
Joey Carson Avatar asked Jan 27 '15 15:01

Joey Carson


1 Answers

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

like image 153
Scott Stensland Avatar answered Nov 11 '22 04:11

Scott Stensland