In parallel, a desktop app capable of analysing and visualizing data in real time was to be developed. The app was also designed to reflect our project's mission, ensuring accessibility to all computer platforms, while still being capable of detailed scientific analysis of both voltage signals and ultrasonic data.
The main window displays the FFT spectrum of the current frame.
A frame slider allows navigation through the recording. Playback controls can automatically advance frames.
PlantLeaf can compensate for the non-flat frequency response of the SPU0410LR5H-QB microphone.
Enable:
The corrected spectrum appears as a red curve over the raw spectrum.
The iFFT tool reconstructs the time-domain waveform from FFT magnitude and phase data, allowing analysis with higher temporal resolution.
The window shows:
Additional tools are available for waveform characterization:
These measurements help identify genuine ultrasonic click events.
The PlantLeaf app includes a 4-stage algorithm capable of detecting ultrasonic cavitation clicks in real time. It was calibrated by manually analysing over 50 hours of recordings across three experimental conditions — empty room, unstressed plant, and mechanical-stressed plant — and all its parameters can be fine-tuned to adapt to different recording setups.
Each 2.56 ms frame is scored by its average FFT energy. Only frames that exceed the background mean by more than 5 standard deviations are passed forward. Any consecutive above-threshold frame group longer than 4 frames is discarded entirely, since a genuine cavitation click lasts at most ~2 ms.
The FFT spectrum is normalised to correct for the microphone's non-flat frequency response. The peak bin must exceed 0.85 mV, and the Spectral Peak Ratio (SPR) must stay below a threshold. A real click spreads energy broadly across many bins (low SPR); electrical interference concentrates it in 1–3 bins (high SPR) and is rejected.
Surviving frames are reconstructed via inverse FFT and their Hilbert envelope is computed. All six criteria must pass:
When a click straddles two consecutive frames, only the frame with the higher peak amplitude is kept, eliminating any double counts.
Result
Tested on ten hours of recording in an empty room, the algorithm produced a false detection rate of just 0.7 clicks/hour.
For full parameter details and the mathematical derivations, see the technical documentation on GitHub:
GitHub Documentation