I want to split the audio data of a mp3 file and perform an FFT transformation on each of the chunks.
All of my attempts to read from the audio stream did not work so far. Here is the code for my last attempt (it uses a wav file)
using (var ms = File.OpenRead("reggae.wav"))
using (var rdr = new WaveFileReader(ms))
{
int steps = 100;
int stepSize = (int)rdr.Length / steps;
byte[][] audData = new byte[steps][];
for (int i = 0; i < 10; i++)
{
audData[i] = new byte[stepSize];
rdr.Read(audData[i], i * steps, stepSize);
}
}
I get an array out of bounds exception with this code.
What kind of streams do I have to use and how do I read the data from it?
Is there any documentation for the naudio api?