Monday, 4 July 2016

fft - Is there a technical term for this simple method of smoothing out a signal?


Firstly, I am new to DSP and have no real education in it, but I am developing an audio visualization program and I am representing an FFT array as vertical bars as in a typical frequency spectrum visualization.


The problem I had was that the audio signal values changed too rapidly to produce a pleasing visual output if I just mapped the FFT values directly:


enter image description here



So I apply a simple function to the values in order to "smooth out" the result:


// pseudo-code
delta = fftValue - smoothedFftValue;
smoothedFftValue += delta * 0.2;
// 0.2 is arbitrary - the lower the number, the more "smoothing"

In other words, I am taking the current value and comparing it to the last, and then adding a fraction of that delta to the last value. The result looks like this:


enter image description here


So my question is:





  1. Is this a well-established pattern or function for which a term already exsits? Is so, what is the term? I use "smoothing" above but I am aware that this means something very specific in DSP and may not be correct. Other than that it seemed maybe related to a volume envelope, but also not quite the same thing.




  2. Are there better approaches or further study on solutions to this which I should look at?




Thanks for your time and apologies if this is a stupid question (reading other discussions here, I am aware that my knowledge is much lower than the average it seems).



Answer



What you've implemented is a single-pole lowpass filter, sometimes called a leaky integrator. Your signal has the difference equation:



$$ y[n] = 0.8 y[n-1] + 0.2 x[n] $$


where $x[n]$ is the input (the unsmoothed bin value) and $y[n]$ is the smoothed bin value. This is a common way of implementing a simple, low-complexity lowpass filter. I've written about them several times before in previous answers; see [1] [2] [3].


No comments:

Post a Comment

readings - Appending 内 to a company name is read ない or うち?

For example, if I say マイクロソフト内のパートナーシップは強いです, is the 内 here read as うち or ない? Answer 「内」 in the form: 「Proper Noun + 内」 is always read 「ない...