Not returning sampleCount

Aug 4 at 7:24 PM
ok I am not returning sampleCount which is 52920 in my WaveStream class for Read.

I am making Brown noise and then filter it out using a fft filter so I can only do 2^N samples at a time.
the close thing to 52920 that is 2^N is 32768.

but than the buffer has a lot of zero in it. and when I play it is sound bad.
I return 32768 in Read, but that is not fix how it sound.

Also this is without adding the FFT filter , just only returning 327680 sound bad.
it I return 52920 it sound good.

so How can I only return 327680 at a time and not have zero in my buffer
can i make the buffer smaller or bigger ?
I only need this because FFTs only work with 2^N number

also I tried to set
PadWithZeroes to false
but it did not help
Aug 5 at 8:42 PM
ok I saw that I can change waveout.DesiredLatency.
but it only takes int and without a double I cannot get it to return 2^n.
the closest thing I can do is:
waveout.DesiredLatency = 1486;

and then my buffersize is 262136.
but that is off by 8 points

2^18 is 262144.

is there anyway to make buffersize = 2^n?

thanks
Coordinator
Aug 6 at 10:57 AM
Have a look at the SampleAggregator class in the NAudio WPF demo. This holds a buffer for FFT, and when it has got enough samples, it performs the FFT. This means it doesn't matter what the read size from your Wave provider is.
Aug 6 at 7:36 PM
Mark,
I was looking at your code, but you do not change your buffer size from read.
you have a fft buffer and you set that size to 1024 and you enter your values in there and do a fft.

but I am doing a fft filter, so I need to filter out all the signal before I play it.
if I do what you are doing I would miss the remaining values in buffer that you are skipping.
what you are doing would only work in your buffer.length/1024 was even. but in my case it do not seem to ever be even .

do you understand what I am saying?
or
did I miss something?
Coordinator
Aug 6 at 7:41 PM
the same technique applies, you'd just need to do an extra read on your source, and save some leftovers of the FFT. What I'd do in your situation is make an adapter ISampleProvider which always returns the number of samples requested in Read, by calling into the source provider enough times to fulfill the request, buffering any leftovers.
Aug 6 at 9:13 PM
ok I starting hearing a tick and after troubleshooting I learned that i get a tick when I do this :
waveout.DesiredLatency = 1486;
I do not understand why,
the code should work no matter how big the buffer is. I checked my return value and the buffer and everything looks good
have you had any problem with changing waveout.DesiredLatency ?

wait are you saying to do the fft and then ifft, over and over and just not send the remaining values and keep them for the next interval ?
um...

so waveout will not play the missing values as 0, 0, ?
I mean the buffer would still have 0s in it when read is done right?
is would have zeros because the remaining values are not being played but then the next time read it called...
right?
Aug 6 at 9:51 PM
ok I just tried to do
a fft at length 32768
and i return 32768,

but you can hear where it stops at ...
it has a beat and it should not.


so what do I do?
I do not want the zeros to be played?