phyphox Forums
Acoustics - Printable Version

+- phyphox Forums (https://phyphox.org/forums)
+-- Forum: Discussion (https://phyphox.org/forums/forumdisplay.php?fid=1)
+--- Forum: Experiments and Ideas (https://phyphox.org/forums/forumdisplay.php?fid=4)
+--- Thread: Acoustics (/showthread.php?tid=404)



Acoustics - moraiscarolinav - 09-27-2019

Hello, 
I would like to know more about the programming logic behind the Audio Spectrum Experiment!
It's for a project from Electrical Engineering's Department of my University.
The FFT Fast Fourier Transform was used, right? To do the measures of the sound recorded with the microphone.  
How the audio was recorded in blocks (to be analised later)?

Thank You.


RE: Acoustics - Sebastian Staacks - 09-30-2019

Well, if you want to know every detail, you can have a look at the source (https://phyphox.org/source/) and especially the definition of the audio spectrum experiment (https://github.com/Staacks/phyphox-experiments/blob/master/audio_spectrum.phyphox). You could also load it in our editor (https://phyphox.org/editor), but since the original experiments were not created with the new editor, the initial layout will be random and hard to read.

That being said, I know that it will be hard to get everything from source, especially since the logic of the experiment is defined in our own file format and interpreted by the app, so I will try to answer some of your questions directly.

When an experiment configuration uses data from the microphone, phyphox will record data from the microphone into a buffer of finite size. Phyphox executes the analysis steps defined in our file format periodically (you might want to have a look at the intro for the editor to understand the principles of our file format: https://phyphox.org/wiki/index.php?title=Analysis_modules) and each time this happens, the recorded data is taken from the buffer. Also, if the buffer overflows, old data is simply replaced.

The Audio Spectrum Experiment sets the analysis interval large enough, so that the buffer always gathers at least as many new data points as defined by the user under "settings" (this also means that some data will almost certainly be dropped). The buffer is then cut down to the desired size and then fed into our FFT module (we do not apply any windowing function aside from the unavoidable rectangular window).