This project has moved. For the latest updates, please go here.

What audio format does MpegFile.ReadSamples return?

Jun 12, 2014 at 1:12 PM
Hello everybody,

since there is no documentiation on nlayer, I would like to ask, what audio format does ReadSamples return? It is a byte array, but what does it contain?

Thanks for answers.
Jul 3, 2014 at 4:00 PM
It returns 32-bit little-endian floats. You can copy it to a float[] buffer (use Buffer.BlockCopy), then do your processing from there.

The samples are started in channel-interleaved format (just like WAV files).
Jul 4, 2014 at 12:03 PM
Thanks for the information. Is it the normal range of wav files [-32768 ... +32768] or normalized [-1.0 ... +1.0] or maybe something else?
Jul 4, 2014 at 3:24 PM
It's nominally [-1.0 ... +1.0], but you should expect some out of range values with "loud" sounds. Deal with them like you would any other out-of-range samples (usually clipping, but an audio compressor will also do the trick if set up correctly).
Jul 16, 2014 at 1:59 PM
Thanks, that helped me :).