Search code examples
debuggingvlcplaybackpcm

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.


Solution

  • 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