# Purpose of multiplying fft output by Hann window?

I'm working with some acoustic propagation models at the moment. A feature I've noticed in 2 of these models is that the output of the model is often multiplied by a Hann window in the frequency domain immediately before reporting the results in the time-domain.

I've been struggling to understand the idea behind this, as I'm only familiar with window functions applied in the time-domain.

To give some background... these models operate by (to my understanding):

1. Simulating a theoretical rectangular spectra (with equal phase values for all frequencies).
2. The models then calculate the loss per frequency as sound propagates through the environment.
3. Frequency domain and time domain plots are typically returned to view the results in an intuitive fashion (dB loss per frequency).

I am assuming that to convert this back into the time domain (to show the effects of spectral dispersion), the Hann window somehow makes this signal viewable, as otherwise the flat phase values would result in non-sensical time domain signals.

• Can anyone briefly describe the DSP theory behind multiplying a flat (rectangle) spectra with a Hann window of the same size?

Below I have shown some relevant matlab code. This piece of code (as I understand) frequency shifts the signal (phs), multiplies the frequency domain by a hann window (hanwin), then converts back into the time domain fft. The resulting tlpressd is used to plot the dB propagation loss per time in the resulting plot. The looping term just runs through all the output ranges of the environment.

hanwin=hanning(nf+1);
hanwin=fftshift(hanwin(1:nf)/sum(hanwin(1:nf)));
phs=2*pi*cfreq*time;
if optout == 1
for irng=1:nrout,
pressd(irng,:)=fftshift(fft(pressd(irng,:).*hanwin')).*exp(-j*phs);
timeout(irng,:)=time+rngout(1,irng)/(c0/1000.);
end
% pressd = complex pressure field, row = range; col = time
tlpressd=-20*log10(max(abs(pressd),1.e-20));


### Notes

FYI, the code above is from Kevin Smith's "Monterey-Miami Parabolic Equation" propagation model. It converts the resulting green's function solutionsof the model into a one of several visual representations (time vs Frequency, or Frequency vs Depth ,etc)

To give more context (and possibly more confusion). If I replace the variable hanwin with any time-domain signal of my choice, the end of the code block provides be with the convolution of that signal with the propagation effects the model calculated (i.e. it simulates the effects of propagation on the provided signal). Its clear that I'm convolving the Hann window with my model output... but I have no idea what the signal theory behind this is.

• Any references to the models you could post maybe?
– A_A
Apr 3 '19 at 9:41
• Unfortunately the literature about these models only discuss the propagation theory... not the practical issues regarding how to report the results of the models. I will look tonight for another example from publicly available code. That may give you more to go on (the current model I'm using was provided by the models author and only the compiled binary is public) Apr 3 '19 at 11:12
• it appears to me that you are multiplying the input to the FFT with a Hann window. this is the typical application of windowing. the purpose of using a Hann window (or some other window that is tapered at the ends) is that your pressd(irng,1:nf) data was likely drawn from a stream of samples wider or longer than nf samples. that is inherently rectangular windowing, usually considered the worst kind. Apr 3 '19 at 20:10
• @robertbristow-johnson This is definitely not a typical application of the Hann window. I assumed the same when I first saw this code. The input of the fft here is already in the frequency domain, and the resulting output, is the time-domain. I have verified this by plotting the results of this code block. tlpressd is definitely time-domain by the end of this code block. Apr 4 '19 at 9:46
• why are they using fft() instead of ifft() ? multiplying frequency-domain data with a window is no different than multiplying by a transfer function. so they are applying a form of low-pass filter to your frequency-domain data before the fft() and the result will be something like an output, but the fftshift() applied to the output sorta messes that up (puts t=0 into the middle) and using fft instead of ifft will time reverse the result. Apr 4 '19 at 19:18

Can anyone briefly describe the DSP theory behind multiplying a flat (rectangle) spectra with a Hann window of the same size?

Without any reference to the actual model and its purpose, the only thing one can say about this is that due to the convolution theorem, the described multiplication results in some form of a digital filter. That is all one can say about "modulating" the frequency domain with any sort of function.

BUT, based on this excellent exposition of the way parabolic equations can be solved via the Discrete Fourier Transform, it seems that the multiplication is performed in both the spatial and frequency domain to isolate specific parts of the signal "gracefully".

Now, the authors seem to indicate that the multiplication is done to "...avoid aliasing...", but I cannot see how the results of these operations can lead to aliasing when:

1. One is in full control of everything about the simulation
2. The first "plane" (the one that is generated at the source) would only contain harmonics form the desired spectrum and be zero elsewhere anyway.

So, I cannot see how extra harmonics are likely to creep in between integration steps to have a need to isolate them.

Therefore, a more likely reason might be to be able to "isolate" (or focus on) only a part of the domain in a graceful way, rather than setting it to zero.

Hope this helps.

• This is helpful! Fantastic that you found a contextually relevant reference. I never thought to look into "in-air acoustics" for more information about Parabolic Equation models. I will try to skim this doc ASAP. Apr 4 '19 at 9:59
• @RTbecard Glad to hear you found this helpful. You can upvote or accept the answer via the controls on the left of the answer. Accepting the answer will stop it from circulating the board as "unanswered" too. The DFT can be used to solve differential equations and that is what I started searching for initially but adding the "parabolic equation" context helped a lot.
– A_A
Apr 5 '19 at 9:28
• It may be a few days until I can skim this report, so for now I'll accept this as the answer as its provided me with useful references. When I make more progress on this question, I'll provide an update. Apr 7 '19 at 15:01
• @RTbecard Thanks for letting me know, good luck with your project
– A_A
Apr 8 '19 at 4:32