# Logarithmic Smoothing - A Tutorial and Two Package Ideas

As a person interested in acoustics, I often plot FFT results on double-logarithmic scales. The results are often pretty noisy and smoothing is typically applied, for example with a width of 1/12 octaves. Unfortunately, so far there has been no easy way to perform smoothing and resampling on a logarithmic axis in Julia.

I’ve now written a little demo/tutorial notebook to change that: GitHub - Firionus/logarithmic_smoothing_julia_demo: How to perform logarithmic smoothing in Julia

If you also need log smoothing, I hope you like the way it works in the tutorial. I’ve certainly implemented it badly way too many times before and now finally found the time to do it properly. If you see any mistakes or have questions, please leave a comment

As for the broader appeal, the tutorial uses two unregistered packages I wrote:

Before registering these packages I’d like to take in some feedback. Is their functionality something you can see yourself using? Do you think they should be registered? Do you see any obvious problems with their code? If so, let me know in the comments. I’d love to hear from the community

2 Likes

Have you considered plotting something like the Welch periodigram rather than the basic FFT (standard periodigram)?

The Welch method also smooths on the linear frequency axis like most other algorithms, so it isn’t applicable to this problem. Maybe this quick plot serves to visualize that:

With the Welch method, either the high frequencies are still noisy (Welch 50sp) or the resolution at low frequencies is way too low (Welch 250sp). The log-smoothed version has similar detail throughout the frequency range when plotted against a logarithmic frequency scale.
Additionally, in acoustics most of the time you’re looking at the FFT of an impulse response, so energy concentration in the time domain is quite high. But the Welch method seems designed more for noise-like rather than click-like signals.

Since you brought up a method that windows in the time domain: Instead of performing a single FFT and then smoothing, you can perform a DFT where you apply a different window for each frequency and the width is proportional to the inverse of the frequency. Variants of this exist in many acoustic measurements softwares, e.g. “frequency dependent window” in REW and Acourate, “Adaptive Window” in MLSSA (http://www.mlssa.com/pdf/DRA-MLSSA-Manual-10WI-8.pdf) or “Dual Gate” in ARTA.
The result is also log-smoothed, but reduces the influence of parts outside the center of the impulse response for high frequencies. This is thought to better resemble human hearing, and there are good reasons to believe that. But I haven’t seen any proper empiric research on that yet. (Paper on that topic: https://www.researchgate.net/publication/241628057_Generalized_Fractional-Octave_Smoothing_of_Audio_and_Acoustic_Responses) But enough of me rambling for tonight , thanks for commenting

2 Likes

Cool, thanks for sharing

this reminds me of the Wigner-Ville spectrogram.