# 1/n octave smoothing

Given a frequency response obtained with FFT, I would like to apply a 1/n octave smoothing. What filter should I be using and how? Maybe someone could point to a good reference (a paper or book on the subject).

• Are you looking for a pinking filter, which attenuates frequency $f$ to amplitude $1/f$? Or do you really want something that attenuates frequency $f$ to amplitude $1/(\lg_2 f)$? – Wandering Logic Jul 18 '13 at 12:04
• I don't want to attenuate any frequencies. I want the data to be smoothed, with a variable bandwidth, i.e 1 octave, 1/3 of an octave, etc. – Psirus Jul 18 '13 at 12:23
• Loudspeaker frequency responses are typically smoothed, either to make the graph easier to interpret but still quite accurate (1/20-octave smoothed), or very high smoothing (1/3-octave) for example in marketing. This is what I've read numerous times, what is meant exactly I'm trying to find out here. – Psirus Jul 21 '13 at 14:23
• So your question is not about changing a signal, per se, it's about how to graphically show the frequency response of a device. Is that right? – Jim Clay Jul 22 '13 at 13:46
• I think this article contains valuable information. However, unfortunately, it is not free. The fundamental approach is also described in this one. – applesoup Feb 23 '16 at 23:54

Typically "smoothing" means "replace the current value with average over the neighboring ones". Most common is energy smoothing, where the smoothing results in the energy average over the smoothing interval and the phase information is lost. Complex smoothing can be done as well but it's tricky business because of phase wrapping.

Energy smoothing can be expressed as $$Y(k)=\sqrt{\frac{1}{N}\cdot \sum_{i=0}^{N-1}X(i)\cdot X^{*}(i)\cdot W_{k}(i)}$$

where $W_{k}(i)$ is some suitable window function. In the case of, say, third-octave smoothing this could be derived as the the magnitude squared of the transfer function of a third octave band pass filter around frequency k. This also means that for a, say, 1024 point FFT you need to design 1024 different bandpass filters, so that's a fair bit of work.

Things can be simplified if the exact shape of the smoothing filter is flexible. Rectangular smoothing can be done as $$Y(k)=\sqrt{\frac{1}{b-a+1}\cdot \sum_{i=a}^{b}X(i)\cdot X^{*}(i)}$$

where $$a = round(k*2^{-\frac{1}{2\cdot n}}), b = round(k*2^{\frac{1}{2\cdot n}})$$

are simply the indices of the band edges for $n^{th}$ octave smoothing.

There are a few more methods that are in between in the arbitrary window and the rectangular one in terms of complexity.

• I'm trying to implement this in C code, and I'm afraid I get a little lost in the notation. I'm having a hard time understanding how for example, the summation of i running from a to b works? Any assistance appreciated. – Andrew Smith Dec 16 '13 at 14:39
• Two thumbs, but alas only one vote, up. This additional question asks how 1/n complex smoothing is done including the tricky business around phase wrapping. – SpeedCoder5 Jun 1 '14 at 18:07