This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

How did you implement the FFT in the app?
#2
Well, we went for the fast but not exactly easy route. Phyphox uses the fftw library (as it is GNU GPL, this is only possible since phyphox is open source, too) through Android NDK. So fftw is written in c and compiled into native code for all the different architectures. This should be one of the fastest ways to do it, but it is not necessarily simple to set up. The interface between Java and C++ (NDK) can be seen in https://github.com/Staacks/phyphox-andro...alysis.cpp and https://github.com/Staacks/phyphox-andro...lysis.java. (Sorry, the latter is one of the older ugly parts of phyphox.)

However, I am not entirely sure if you want to use FFT for what you plan to do. The resolution of the Fourier transform is the inverse of the duration of the recording that you transform. So, if you want to resolve two decimal places, let's say 0.05 Hz, you need to analyze 1/0.05Hz = 20s. Not sure if that is what you want and if your tone is stable for 20s - and that is certainly not realtime. Depending on what you already know about your signal and depending on other trade-offs (you don't need the entire spectrum, do you? You do not expect low frequencies on top of your tone?), there are better methods to detect the frequency, but you need to research them as I only have "implementing a better frequency detection" on my todo list without having done the research yet.
Reply


Messages In This Thread
RE: How did you implement the FFT in the app? - by Sebastian Staacks - 04-02-2020, 03:56 PM

Forum Jump: