Play raw buffer of sound with NAudio

May 13, 2011 at 11:24 AM

Hi All,

I have a "midi" type of sound converted to customized as per client, 90% of the sound file is playable, 10% is some raw bytes. I need to cut the file into 90% and 10 % than need to play the 90% of part of the file. I could albe to find that NAudio plays only ".wav" and ".mp3" but if I have custom file it doesn't produce any sound and throws exception that file is not supported.


Kindly help me how to play sound from custom file.


May 13, 2011 at 5:01 PM


If you take a look at Practice# source code, you would see how to process raw audio.

I basically wrote an "ETL" process for audio.  :)

The first stage Extracts the samples from the input file into raw samples.

The second stage Transforms the samples inside the buffer, by applying time-stretching.

The third stage Loads the transformed raw samples back into NAudio, for output.


In particular look look at PracticeSharpLogic.ProcessAudio (PracticeSharpLogic.cs) and AdvancedBufferedWaveProvider.cs



Yuval Naveh

Author of Practice#