# (Newbie question) Calculating the frequency spectrum

I'm quite new to this topic, with some basic knowledge however.

I need to analyse an audio signal for different characteristics.

Like the audio editor I use (an older Version of Audition, v.3) I would like to calculate the occuring frequencies.

• For every time stamp and
• the overall occurences of the frequencies of the whole audio.

If I'm not totally wrong then for calculating the frequency spectrum I have to take an interval (window) of samples. The DCT/ FFT of that returns the complex fourier coefficients (whose magnitudes are the amplitudes of the frequencies). Correct so far?

What I do not understand:

What is the frequency spectrum of a specific time stamp then? Or does it only make sense for a complete interval/ window of samples? But Audition shows a different frequency spectrum for every time stamp... Is it something like a "sliding window" there, calculated for the center sample?

Associated with the above: If it should be (the middle of a) sliding window: How to calculate spectrums for near-border timestamps (which don't have complete surroundings)?

And how to calculate the overall occurences of the frequencies of the whole audido? I can't use the sliding windows for that, as it would count frequencies multiple times (due to the overlapping) ... Is it the average of all the side-by-side (= non-sliding) windows?

Or am I totally wrong with it?

Again: I hope my questions don't hurt too much. ;-)

## 1 Answer

I'm almost tempted to answer with a counter question: what is frequency? It's a question I like to ask students that have already taken signals and systems courses and it's surprising how often they don't know what to answer.

While the whole answer involves some more discussion, what we can definitely say is that frequency is associated to a rate of change of the signal. That automatically means that looking at a signal in one moment of time makes it impossible to say anything about its frequency content, because we cannot see how rapidly it changes.

Therefore, most of what you say is true: a frequency analysis only makes sense for a certain window in time. One can use sliding windows, typically one defines some overlap between adjacent windows, depending on what exactly one is after. The length of the window is a trade-off: longer windows will give you a better frequency resolution (watching the signal change over a longer period of time makes us more certain how exactly it varies) but less resolution in time (if the frequency content changes over time, we may want to be sensitive to that change and if a change is so sudden it appears within one window, we might miss it).

For the borders, it depends what you know about your signal. Either you clip them, or you pad them with something that is meaningful. This can be zeros, it can be a mirrored image of the samples you know (this is more common in image processing), it can be a periodic copy of the end (this is done in communications for other reasons). In most cases, signals are long enough so that we don't need to worry about the edges that much.

As for your last question, I'm not sure I get what you mean by overall occurences. But of course you could average your windowed spectra to get an "average spectrum". This is referred to as Bartlett's method, some sources call this the periodogram (careful, the term is used in conflicting manners in the body of literature).

• Thank you very much (!) for supporting me that I'm not totally wrong. Now I can investigate further to find out what is meaningful for my purpose. Sep 16, 2020 at 9:13
• You're welcome! Glad it helped. :) Sep 16, 2020 at 10:45