Please do. Unfortunately I don't know of any way to get sound samples directly into memory.would you mind if I would mention you in the credit list of my app ?
I'm not too hot on maths. I understand interpreting the real and imaginary values obtained using the complex FFT with only real input values and the imaginary input values all 0. I don't understand what the real and imaginary values obtained represent when the imaginary input values are also sampled values. I've Googled but not found an answer (that I understand!). Is there an easy explanation?As your samples are real, you dont even need to add the imaginary samples with 0 values.
klaus;32755As your samples are real said:I tested this with another version, and you are absolutely right:
An fft transform of a 4096 byte array with all real values gives indeed the 2048 real and 2048 imaginary numbers as a result, containing all necessary information.
An fft transform of what I did first, that's a 8192 real+imag byte array, with a real sample and a zero, a real sample and a zero, and so on, gives off course the double number of results, but the last half is completely symmetric, and therefore useless to anyone. That's the way MS Excel does it, and I should have known:
Anyway, my arrays are only half as large now, probably giving even more speed improvement, and especially less memory usage. Thanks for the tip !
I'm not sure what you mean by "your algorithm" but the library does a complex input FFT. I think the long words and funny symbols in the articles that I Google are the problem to my not understanding.I suppose that your algorithm is a real input DFT.
Sub CalcSin(nb)
Dim I As Number
Dim j As Number, w0 As Number, w1 As Number, w2 As Number
w0=cPI/ND2
w1=cPI/ND2*4
w2=cPI/ND2*10
lbxResult.Clear
For i=0 To NM1[COLOR="red"] Step 2[/COLOR]
data(i)=Sin(w0*i)
[COLOR="Red"]data(i+1) = 0[/COLOR]
If nb=3 Then
data(i)=data(i)+[COLOR="Red"]Cos[/COLOR](w1*i)
data(i)=data(i)+Sin(w2*i)
End If
lbxResult.Add(i&" "&data(i))
Next
FillList(NM1,"Sinus")
End Sub
Ahh, thanks Klaus - no wonder I didn't understand what was going on!The imaginary samples set to 0 are necessary.
I kept the conversion as individual ones for that reason so as to keep things quick.the amplitude because in frequency analysis that's what the user is the most intersted in, the phase is not that impotant.
It needs to be calculated separately anyway as the algorithm produces Sine and Cosine. As the overhead of doing them in the Basic4ppc code rather than automatically in the library is very small, only that of a single call to the library and as only Amplitude is interesting a lot of the time I didn't incoporate it into the actual Transform. Also having Real and Imaginary available lets you see what is going on if you need to.I was thinking about getting Amplitude and Phase directly in return from Fft.Transform ... This would avoid needing to calculate it afterwords.
I've no idea why the IDE thinks that FFT is a keyword, it doesn't highlight other library objects, although I have suggested to Erel that it should but he wasn't keen on the idea.I have seen that Fft, the name of the FFT object, is highlighted in green in the IDE
I've no idea why the IDE thinks that FFT is a keyword, it doesn't highlight other library objects, although I have suggested to Erel that it should but he wasn't keen on the idea.
It does use the .NET Math.Atan2 function. It is the same Atan2 function as Basic4ppc uses so the problem must be elsewhere.The Tan function should be the ATan2 function
I was waiting till we were happy with it and then I was going to do a help before starting a new library thread for it.Shouldn't we open a new thread for the FFT library ?
... as the IDE now knows the type of the object so a library name is now relevant within code.
Could you please confirm this rather simple question for me
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?