judeclarke
judeclarke

Reputation: 1116

Getting audio buffer data

I am using naudio and I was curious how I could get the audio buffer data.

Is there a way to obtain the audio buffer data from a Wave file read from WaveFileReader? I would like to eventually save it to a file.

I assumed that to do so was

byte[] buffer = new byte[wave.Length]; wave.Read(buffer, 0, (int)wave.Length);

However, is wave.length the length of the audio data buffer, or is it the length in respect to duration? If not duration, how can I get the duration?

Upvotes: 0

Views: 1547

Answers (1)

Mark Heath
Mark Heath

Reputation: 49502

wave.Length is the number of bytes of audio data. The TotalTime property of a WaveStream will attempt to convert this into a TimeSpan.

Upvotes: 0

Related Questions