Transefer function

May 17 at 3:28 PM
Hi guys,
I've got a little problem with apllying transfer fuction. I need to take data from .wav file and make convolution with transfer function and play this sound in real time. Thank you for advices. I'm new to NAudio.
May 17 at 4:04 PM
Hi, this is not a trivial task. For realtime processing you can´t process the data in the time domain, which would be simple coding (using the class "ImpulseResponseConvolution"). The only approach is complex and demands a lot of knowledge: you need to transform the data in the frequency domain, process it and transform it back. For transformation the "FastFourierTransform" (FFT) or "ShortTermFourierTransform" (STFT) is commonly used. Unfortunately, there is no implementation available in NAudio, but good luck (and pls provide if you can deploy it).
May 17 at 4:30 PM
Edited May 17 at 4:31 PM
Thanks,I thought, I could just fit my input data from wav file to transfer function...
May 17 at 6:56 PM
I recommend to look at the FastFouriertransformation class and the sampleaggregator class for a start.
Wed at 12:53 PM
Hello, so I tried to do FFT with use of SampleAggregator.cs, but I'm not shure, if I realy understand class SampleAggregator - Is that instance, witch take samples from my wave file (or any input), and apply FFT algorythm for every single sample of my wave file - this is the method Add in this class -right? And length of FFT means, how large is step between couted frequencies in spectrum? For example if is frequency of my point[n] = 100Hz, frequency of point[n+1] is my sample rate/ FFT length, so if I've got sample rate 44100 and FFT length 1024, point[n+1] = point[n]+(44100/1024), so if my point[n] is 100 my point[n+1]= 143,066.... ??? I'm right or absolutly dumb...?? :-D
Thanks for answer.
Wed at 6:43 PM
Edited Wed at 6:47 PM
I´m not deep into the the maths, but what I know so far is:

Each bin of the FFT result is equally spaced in the frequency spectrum.

For example when SampleRate is 44100 Hz and FFT Size is 1024:
frequency[0]=0*44100/(1024*2) // First bin is always 0 Hz, called the DC offset
frequency[1]=1*44100/(1024*2) //Second bin, here at 22 Hz
frequency[2]=2*44100/(1024*2) //Third bin, here at 44 Hz
frequency[1024]=1024*44100/(1024*2) //Last bin is always half SampleRate, here 22050 Hz
So just loop over the FFT Result and calculate the frequency and amplitude.
Thu at 6:48 AM
So, I tried to do FFT of my wave file and than apply my poly transfer function:

void FftCalculated(object sender, FftEventArgs e)
         //y[n] = A*x^3[n] + B^2[n] + C*x[n] + DI; // my transfer function

            for (int i = 0; i < e.Result.Length; i++)

               fftResultX[i] = e.Result[i].X; // result of fft for Complex.X
               fftResultY[i] = e.Result[i].Y; // result of fft for Complex.Y
               fftResultH[i].X = A * (e.Result[i].X) * (e.Result[i].X) * (e.Result[i].X) + B * (e.Result[i].X) * (e.Result[i].X) + C * (e.Result[i].X)+D; //distortion - fit my fft result to my transfer function
               fftResultH[i].Y = A * (e.Result[i].Y) * (e.Result[i].Y) * (e.Result[i].Y) + B * (e.Result[i].Y) * (e.Result[i].Y) + C * (e.Result[i].Y) + D;
where fftResultH is spectrum with distortion effect of my transfer function. And now I want to playing my effected sound in real time / when I open my wave fine and press my play botton I want to hear effected sound, where I can changing parameters A,B,C,D of my transfer function in realtime... Can I do it this way?
I'm using SampleAggregator.
Thu at 2:41 PM
Girl, you got no idea what you´re doing. Besides that and your load of spelling mistakes, as I said initially it is NOT a trivial task. I don´t even know myself exactly how to do it.