Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

New Post: noisy input

$
0
0
Hold on, sorry I got confused earlier, I thought the buffer was an int buffer. That explains why you were shifting << 8.


Anyway, assuming the WaveIn data is PCM, try this:

for(int n = 0; n < buffer.Length; n+=2)
{
intBuffer[n/2] = BitConverter.ToInt16(buffer, n);
}

That should give you a paired stereo array. Divide each int by 32768.0d to get a double sample. I dont know how that graph process the data but you may want to drop the Right channel and test it with just the Left channel, or mix them using (doubleL + doubleR) * 0.5d;

If the buffer contains IEEE data, use BitConverter.ToSingle() using a float array instead, cast to double

Viewing all articles
Browse latest Browse all 5831

Trending Articles