I am programming clone of guitar (violin) Hero as a final project for this school year.
The idea is to take input from my electric violin, analyse it via FFT, do so
The problem was as I thought in conversion between data about samples from Asio (4 bytes in a row in buf array) to float for fft. BitConvertor should do the trick but it somehow makes fft output NaN in my case. So I tried this conversion instead.
for (int i = 0; i < e.SamplesPerBuffer * 4; i=i+4)
{
float sample = Convert.ToSingle(buf[i] + buf[i+1] + buf[i+2] + buf[i+3]);
sampleAggregator.Add(sample);
}
And it works very well. Even with 192 000 sample rate.