mborgerding / kissfft

a Fast Fourier Transform (FFT) library that tries to Keep it Simple, Stupid
Other
1.39k stars 278 forks source link

About implementation in swift #66

Open muga87 opened 2 years ago

muga87 commented 2 years ago

Hi there, I need to calculate fft in my iOS project using byte array which from sound record. I can able to integrate kissfft in my project. As per documentation to calculate fft, I have used like this.

for init 
let kissFT = kiss_fft_alloc(Int32(sampleRate), 0, nil,nil)
for calculating cpx_in and cpx_out I have tried like this, but I could not ale to find the method
 let cpx_in = kiss_fft_cpx(r: <#T##Float#>, i: <#T##Float#>)

Here I have to pass ‘r’ and ‘i’ values. But I am not understanding what values I have to pass. Can you please help me.

Where in android I am using like this using DoubleFFt_1D java class.

DoubleFFT_1D fft_1d = new DoubleFFT_1D(windowSize); double[] rowFFT = new double[2 windowSize];   for (int win = 0; win < windowSize; win++) { rowFFT[win 2] = sample[win + time (windowSize - overlap)] windowing[win]; rowFFT[win * 2 + 1] = 0; }