The Frequency Domain
A microphone hands a computer a list of numbers and nothing else. No note names, no instruments, no separate voices. Somewhere in that list is the fact that a smoke alarm is sounding. Or that somebody said a particular word, or that an aeroplane thirty miles away is announcing its height. Getting a fact like that out of a list of numbers starts by working out which sine waves the list is made of. This course does that by hand, on eight samples, with eight multiplications you can check on paper, before any machine does it for you. By the end you will be able to read a spectrum and say what its bars can and cannot tell you. You will also be able to say why the fast way of computing one changed what computers are used for.
One transform sits underneath every step, and it is the slow obvious one. For each frequency it might be looking for, it multiplies your samples by a cosine and adds the products up, then does the same against a sine. Two sums, one hypotenuse. That is a bar of the answer. Nothing on any page is looked up. Where a step says that a tone landing between two bins smears into every bar, something on that page builds that tone, transforms it, and reads the bars off. Where a step says the fast method needs a hundred times fewer multiplications, a counter has counted them both.
Two courses in this stream come before this one. Sound and Signals gives you a wave, a sample, a sample rate, and the reason a frequency above half the sample rate comes back as something it is not. Filters gives you the habit of pushing one sine through a thing and measuring what comes out. Neither is strictly compulsory and the words are all reintroduced here as they arrive.
Beyond that: arithmetic with negative numbers, and one fact of geometry, that the long side of a right-angled triangle is found from the two short ones. There is no calculus here and no summation signs. Every sum in this course is written out in full, because the whole promise is that you can do one with a pencil.
The steps
Hear one sound as a recipe of pure wiggles
Press three piano keys at once and you get a chord: several notes sounding together. Your ear does not receive three tidy notes. It receives one messy wiggle of air, all three notes added into a single motion. Yet you can hear that there are three. Something in your ear takes the mixture apart again. A prism does the same job with light. Sunlight looks white, but send it through a wedge of glass and it spreads into a band of pure colours. The prism invents nothing. The colours were in the mixture all along, and it sorts them.
This course does that trick with arithmetic. The claim underneath it is worth stating early: any wiggle is a recipe of pure wiggles. A pure wiggle is a smooth rise and fall that repeats at one steady rate. A recipe is a short list: how much of this ingredient, how much of that. The messy wave is the finished cake, and the whole subject is learning to read the recipe back off the cake.
You have seen the recipe drawn on a screen already. An equaliser in a music app is a row of sliders, one per ingredient, slow rumbles at the left and fast hisses at the right. Push a slider up and there is more of that pure wiggle in what you hear. That row of sliders is the sound seen from the frequency domain: not the wave against time, but the recipe. The wave against time is the time domain. Same sound, two honest pictures of it, and this course is about walking between the two.
Is that claim really true for any shape at all?
For any shape that repeats, yes. The proof is one of the famous results of mathematics: Joseph Fourier's claim of 1822, doubted loudly at the time. A recipe of smooth ingredients making a cornered shape sounds impossible. It is not, and the lab below lets you watch corners being built from smoothness.
This course does not ask you to take the claim on trust. It works on short lists of numbers, and for those the recipe can be computed exactly and then run backwards. The samples come back to the last decimal place, and a later step measures exactly that.
What exactly counts as a pure wiggle?
A wave that rises and falls the way a point on a spinning wheel rises and falls: smoothly, evenly, for ever, at one steady rate. Its proper name is a sine wave, and Step 1 pins it down with three numbers. For now the picture is enough: one ingredient, one steady rate of wiggling.
What makes it pure is what it lacks. Play it and you hear one flat, featureless tone, like a tuning fork or a test tone. Everything with character, a voice, a violin, a doorbell, is a mixture, and the character lives in the recipe.
Does my ear really take sound apart, or is that a metaphor?
It really does, physically. Inside the ear is a coiled ramp called the cochlea, stiff at one end and floppy at the other. Each spot along the ramp shakes hardest at one particular rate of wiggling. So a mixture of rates lights up a pattern of spots: fast ingredients near the entrance, slow ones deep inside.
The nerve to your brain reports which spots are shaking. So what you hear is closer to the row of equaliser sliders than to the wave itself. Your ear has been computing the frequency domain your whole life. This course is about doing the same thing with multiplication, where you can check the working.
One sine, kept as eight numbers
A sine wave is a smooth rise and fall that does the same thing over and over, and three numbers set one completely. How far it swings from the middle is its amplitude. How many complete rises and falls it gets through is its frequency. Where in its own cycle it was when you started watching is its shift, measured in degrees, a whole cycle being 360 of them.
A computer never has the wave. It has samples: the height of the wave measured at evenly spaced instants and written down as a list of numbers. This course keeps eight of them and no more, and eight turns out to be enough to show every idea in the subject. So frequency gets measured in a slightly different unit here. Not cycles per second, but cycles per block: how many complete rises and falls the wave fits into the eight samples you are holding.
Why measure frequency in cycles per block instead of hertz?
Because cycles per block is the only thing the eight numbers actually know. Hand somebody a list of eight numbers with no other information and they can tell you that the pattern repeats twice across the list. They cannot tell you whether the list took a second to record or a millionth of one, so they cannot tell you the frequency in cycles per second.
The two are joined by the sample rate, the number of samples taken each second. Eight samples taken at eight samples a second cover one second, so two cycles per block is two cycles per second, or 2 hertz, written 2 Hz. The labs use eight samples a second for exactly that reason: the two units read the same and there is nothing to convert. Step 7 pulls them apart again on purpose.
Sound and Signals drew waves as sines. Why is this one a cosine?
A cosine is a sine shifted forwards by a quarter of a cycle, which is 90 degrees. Nothing else about it differs: same shape, same amplitude, same frequency. Written as a cosine, a shift of zero puts a peak exactly on the first sample. That one convenience is worth a lot in Step 4, where it makes the first sum you work out by hand come to a tidy number.
If you prefer the sine picture, add 90 degrees to every shift on this page and you have it. The arithmetic is untouched either way.
Why eight samples, and not ten?
Two reasons, and both are real. Eight is a power of two, meaning it can be halved down to 1, and Step 12 is entirely about what that buys. Real systems pick 256, 1,024 or 4,096 samples for the same reason, and almost never a round decimal number.
The other reason is arithmetic you can do. At eight samples the cosine values Step 4 needs are 1, 0.707, 0 and their negatives, and the frequency worked out by hand uses only 1, 0 and minus 1. At ten samples the values are 0.809 and 0.309 and the promise of doing one by hand would be a cruelty.
One thing about eight samples is worth meeting immediately, because the rest of the course leans on it. Count upwards through the whole numbers of cycles per block and the waves stop being new. Four cycles per block is the fastest wave eight samples can hold. Five gives the same eight numbers as three, six the same as two, seven the same as one, and eight the same as standing still.
Two sines added, and a sum that resembles neither
Two waves in the same air add up. At every instant the air moves by the sum of what each one is asking for, and a machine sampling that air writes down the sum. So take two sines with different frequencies and add them sample by sample. The eight numbers you end up with are the eight numbers of the first plus those of the second.
What comes out can look nothing like either part. That is the honest difficulty of this whole subject. The sum is a single list of eight numbers, and nothing in it is labelled. There is no column that says which part contributed what.
Is adding really all that happens when two sounds mix?
For sound in air, yes, to a very good approximation, and it has a name: superposition. Two waves pass through the same place, add up while they are there, and carry on afterwards exactly as if the other had never happened. A shout is not damaged by crossing a violin note.
It matters here because it is what makes the whole course possible. If mixing two tones produced something other than their sum, taking a mixture apart again would be a different and much harder problem, and probably not a solvable one.
How can a sum be shorter than the taller part on its own?
Because at that instant the two parts are pulling opposite ways. A part 2 tall sitting at plus 2, added to a part 1 tall sitting at minus 1, gives 1. Nothing was destroyed: a moment later the second part is somewhere else in its cycle and the sum is different again.
This is why the tallest sample of a sum is not something you can predict from the two heights. It depends on where each part is in its own cycle at the instant the sample was taken, which is exactly what the shift controls set.
Do the two parts have to be at different frequencies?
No, and what happens when they are not is worth seeing. Two cosines at the same frequency add up to a single cosine at that frequency, taller or shorter depending on how well their shifts agree. Two waves became one. Nothing about there having been two survives.
That is not a flaw in the arithmetic, it is the world. Two violins playing the same note reach a microphone as one wave, and no analysis of that wave can count the violins. A bar in a spectrum says how much of a frequency arrived, never how many things sent it.
Going the other way, and finding out how hard guessing is
Here is the question the rest of this course answers. Somebody hands you eight numbers. You are told they were made by adding sine waves together. Which ones, and how tall was each, and how far along was each when the recording started.
Everything a machine does with sound sits on top of that question. Recognising a spoken word means finding which frequencies are present in the last fortieth of a second. Tuning an instrument means finding one frequency accurately. Decoding a radio signal means finding which of two frequencies just arrived. All of them are the same going-backwards problem on a list of numbers.
Is there always exactly one right answer?
For a fixed number of samples, and frequencies limited to whole numbers of cycles per block, yes. Eight numbers can be built from whole-cycle sines in exactly one way, and Step 5 finds it. That is a real and slightly surprising result: the answer is not a good fit, it is the fit.
Allow any frequency at all, not just whole numbers of cycles per block, and the tidiness goes. Step 8 is about what happens then. It is the single most common way a spectrum gets misread.
Could I not just count where the wave crosses zero?
For a single sine, yes, and it is a decent trick: count the crossings, halve the count. You have the number of cycles. For a sum of two it collapses at once. The crossings of the sum are nowhere near the crossings of either part, and how many there are depends on the shifts.
On eight samples it is worse, because a crossing almost never lands on a sample. You know the wave went from plus to minus somewhere between two samples and the list does not say where. Counting crossings is a method for one clean tone and for nothing else.
Where does this going-backwards problem turn up outside sound?
A prism does it with light, mechanically. White light goes in and the colours it was made of come out spread in order. That band is a spectrum in the original sense of the word, and it answers the same question about a different kind of wave. X-rays pointed at a crystal answer it about the spacing of atoms.
A hospital scanner is the most striking case. An MRI machine does not photograph anything. It measures a signal and works out which frequencies are in it, and the frequencies map onto positions in the body. The picture is the answer to a going-backwards problem and nothing else.
It is worth knowing how big the haystack is, because the number is what makes the method in the next step feel like a gift rather than a formality.
Multiply eight samples by one cosine, and add up
The method is one idea, and it is not obvious until you have done it once, so this step does it once, slowly, with your own arithmetic. Pick a frequency you want to test for. Write down the value of a cosine at that frequency at each of the eight sample instants. Multiply each sample by the cosine value beside it. Add up the eight products. That single total says how much of that frequency is in the signal.
Why it works is worth a sentence. Suppose the signal really does contain a wave at the frequency you are testing, lined up with your cosine. Then the products come out positive wherever both are positive, and positive again wherever both are negative, so they pile up. Now suppose the signal contains something at a different frequency. The products come out positive about as often as negative and cancel to nothing. The total is large when your guess is present and about zero when it is not.
Where do the cosine values in the table come from?
From the frequency being tested. For 2 cycles per block on 8 samples, the cosine gets through two complete cycles in eight steps. So it advances a quarter of a cycle each sample: 1, then 0, then minus 1, then 0, and round again. Those four values are the whole table, which is exactly why this step tests two cycles per block first. Multiplying by 1, 0 or minus 1 is arithmetic anybody can do in their head.
For 1 cycle per block the wave advances an eighth of a cycle each sample, and the values include 0.707, which is the cosine of 45 degrees. Nothing changes about the method, only the tidiness. A real program keeps these numbers in a table too, for the same reason you would: working them out again for every sample is wasted effort.
Why does multiplying by a cosine pick out one frequency?
Try it with numbers rather than words. Take the sequence 1, 0, minus 1, 0 repeating, which is the 2-cycle cosine. Multiply it by itself and you get 1, 0, 1, 0 repeating, which are all positive, so the total grows. Now multiply it by the 4-cycle cosine, which is 1, minus 1, 1, minus 1: the products are 1, 0, minus 1, 0, which cancel in pairs and total zero.
That is the property the whole subject rests on. Any two different whole-cycle waves across the same block multiply out to a total of zero, so testing for one of them cannot accidentally report another. The name for it is orthogonality, and you have just checked a case of it by hand.
Two sums, then, not one. The reason for the second is the shift. A wave that has slid along is still there, but it no longer lines up with your cosine, and the cosine total alone would report it as absent. So test twice, once against a cosine and once against a sine at the same frequency. A sine is a cosine shifted by a quarter of a cycle, so whatever the first test misses the second one catches.
Then the two totals combine. Draw them as the two short sides of a right-angled triangle, the cosine total across and the sine total up. The long side is the magnitude, how much of that frequency is present regardless of where it starts, and the angle at the corner is the shift. Two ordinary sums have become a height and a shift.
I have not met the hypotenuse, or I have forgotten it
In any triangle with a square corner, the long side sitting opposite that corner is the hypotenuse, and there is a rule for its length. Square each short side, add the two squares, and take the square root. Sides of 3 and 4 give 9 plus 16, which is 25, whose square root is 5.
Here the two short sides are the cosine total and the sine total, and the hypotenuse is the answer you want. A cosine total of 8 with a sine total of 0 gives a magnitude of 8. A cosine total of 0 with a sine total of 8 gives a magnitude of 8 as well. That is the point: the same amount of wave, sitting in a different place.
Everyone else writes this with complex numbers. Am I being sheltered from something?
You are being shown it in the order that makes it learnable, and here is the translation so nothing is a surprise later. The two totals you have just worked out are usually written as one item, a complex number. Its real part is the cosine total. Its imaginary part is the sine total with a minus sign in front of it, and that minus is only a bookkeeping convention. Magnitude is the hypotenuse of the same triangle either way, so every bar in this course is the number a textbook would print. Step 14 turns the pair into a picture you can hold.
What the complex notation buys is compactness, and the ability to multiply two of these things together in one step. That matters a great deal once you are designing filters, and not at all while you are reading a spectrum. It buys nothing you need today, and paid for in advance it would have cost you this step.
Do it for every frequency the block can hold
Step 4 tested one frequency. There is nothing special about that one, so test them all. For eight samples the whole numbers of cycles per block run from 0 to 7, so there are eight tests, each with a cosine sum and a sine sum. Those eight answers are the complete description of the signal.
That is the discrete Fourier transform, usually shortened to DFT. Discrete because it works on a list of samples rather than on a continuous wave. It is named after Joseph Fourier, who worked out in 1822 that any repeating shape can be built from sines. There is nothing else to it. Two sums per frequency, and one frequency per sample you are holding.
Why exactly eight frequencies for eight samples, and not more or fewer?
Because eight numbers going in should give eight numbers coming out, or something has been lost or invented. Eight samples hold eight numbers' worth of information, and the transform is a rearrangement of it rather than a summary. Step 6 shows the strongest evidence for that. Run the answer backwards, adding the eight frequencies up again with the sums as their weights, and the original eight samples come back exactly.
The eight are not all separately useful, because Lab 3 showed that 5 behaves like 3 and 6 like 2. So there are eight answers and five distinct frequencies, and the other three are mirrors carrying the same information the other way up. Step 6 measures that.
Fourier was working in 1822. Did he do this to lists of numbers?
No. He was working with continuous curves and infinite sums, on the question of how heat spreads through metal. His claim was that any repeating shape can be written as a sum of sines. The version in this course, on a finite list of samples, came later and belongs to the age of machines.
The name stayed because the idea is his. What is different here is that a finite list gives a finite answer: eight samples, eight frequencies, no infinite sum and nothing that has to converge. In that sense the discrete version is the easier one, which is why it can be taught first.
What if the signal is not made of whole-cycle sines in the first place?
The transform still gives an exact answer, and the answer is still eight numbers that rebuild the samples perfectly. What changes is how it reads: instead of one or two bins holding everything, the content is spread across many of them.
That is not a failure and it is not noise. It is the transform saying that the only way to build your samples out of whole-cycle waves is with a little of a great many of them. Step 8 takes one tone that does not fit and looks hard at what comes out.
Each of those eight answers has a name. A bin is one frequency's worth of answer: its cosine sum, its sine sum, and the magnitude and shift that come out of them. The word comes from the idea of sorting something into containers. It is a good word, because a bin holds everything that lands near its frequency rather than only what lands exactly on it. Step 8 is what happens when something lands between two bins.
Reading a spectrum, bar by bar
A row of magnitudes, one per bin, is a spectrum. It is the single most common picture in engineering and it is easy to half-read, so this step goes along it slowly. Each bar answers one question: how much of this frequency is in the block. Four things are worth reading off every bar, and the labs print all four.
Its bin number, counting from 0, which is how many cycles per block it stands for. Its frequency in hertz, which is the bin number times the sample rate divided by the number of samples. Its magnitude, the hypotenuse from Step 4. And its amplitude, the magnitude turned back into a height in the same units as the samples.
Why do the bars above the middle repeat the ones below it?
Because of Lab 3 in Step 1. On eight samples, 6 cycles per block draws the same eight numbers as 2 cycles per block. So a test at 6 cannot help reporting whatever a test at 2 reports. Bin 6 is bin 2's mirror, bin 5 is bin 3's, and bin 7 is bin 1's. Bin 4, the fastest wave eight samples can hold, has no partner and stands alone.
The mirror is not quite an exact copy: the magnitudes match and the shifts come out as one full turn minus the other, which the lab measures. Real programs simply throw the top half away, and every spectrum you meet in the wild has already had that done to it.
What is bin 0 measuring, if zero cycles is not a wave at all?
The average of the samples. A wave at zero cycles per block never rises or falls, so it is a flat line at some height. Testing for it means multiplying every sample by 1 and adding up. Divide by the number of samples and you have the mean.
Engineers call it the DC component, from direct current, meaning the part that is not going up and down at all. A microphone with a slightly wrong zero point puts a large bar there and nothing anywhere else, and taking it off is usually the first thing done to a recording.
Why draw a spectrum as separate bars rather than a smooth curve?
Because there are only as many answers as there are samples, and a curve drawn through them implies readings at frequencies nobody tested. Between bin 2 and bin 3 the transform has said nothing at all and a line drawn there is an invention.
Most software draws the curve anyway, and on a long block with narrow bins it does no harm. On a short block it actively misleads, which is why every spectrum in this course is drawn as bars with their own numbers printed beside them.
Two bars carrying the same information is wasteful, so almost nobody keeps both. The convention is to keep bins 0 up to half the sample count, which for eight samples means bins 0 to 4, five bars, and to discard the rest. Half the sample rate is the highest frequency the samples can describe, which is the Nyquist limit from Sound and Signals arriving from the other direction.
Bin width, and the two things that set it
Eight samples gave five useful bars, which is not many. The obvious question is how to get more, and the answer is the one number that governs every practical use of a transform. The gap in frequency between one bin and the next is the bin width. It is the sample rate divided by the number of samples in the block. Nothing else affects it.
Written the other way round it says something more useful. The number of samples divided by the sample rate is how long the block lasted, so bin width is one divided by the block length in seconds. A block of one second gives bins 1 Hz apart. A block of a tenth of a second gives bins 10 Hz apart, whatever the sample rate is. To tell two nearby frequencies apart you need a long enough recording, and no amount of sampling faster will do instead.
Sampling faster does not help? That seems wrong.
Sampling faster does help with something else. It raises the highest frequency you can describe at all, because that is half the sample rate. What it does not do is put the bins closer together. The arithmetic says why. Doubling the rate doubles the number of samples you collect in the same time, and bin width is the rate divided by the sample count. Both halves of the fraction double, so nothing moves.
You can check this in Lab 14. Set the rate to 32 and the block to 32 samples, note the bin width, then set the rate to 64 and the block to 64 samples. Same one second, same bin width, twice as many bars, and the extra bars are all above the old top frequency.
What exactly is a block?
The stretch of samples handed to one transform. Eight of them in these labs, 1,024 in a typical audio program. It is a choice made by whoever wrote the program rather than a property of the recording, and Steps 7 to 11 are all about what that choice decides.
A recording is usually far longer than one block, so it gets cut into many, and each is transformed on its own. Step 11 makes a picture out of the results, which is where the choice of block length becomes visible at a glance.
Can I get finer bins by padding the block out with zeros?
You can make more bars appear, and it is worth knowing exactly what they are, because this is the most misunderstood trick in the subject. Adding zeros to the end of a block does lengthen it, so the bin width does fall and the extra bars are real calculations.
What they are not is new information. The zeros told the transform nothing, so the extra bars are a smooth interpolation between the ones you already had. Two tones that merged into one hump before padding still merge after it. Zero padding buys a better estimate of where a peak sits and never buys resolution. Only a longer recording does that.
Knowing the bin width is not the same as knowing when two tones will look like two tones. That takes a little more than one bin of separation, and it is worth finding the boundary yourself rather than being told where it is.
A frequency between two bins lands in every bar
Everything so far has quietly assumed that the frequencies in the signal are whole numbers of cycles per block. Real signals have no such manners. A tone at 5.5 Hz, with bins 1 Hz apart, does not fit any bin. What the transform does about it is the single most misread thing in the subject.
So commit to a prediction first. Bins at every whole hertz, a tone at 5.5 Hz, amplitude 1.0. Write down what you expect the bars to look like before pressing anything, and then find out.
The name for this is leakage, or spectral leakage. It happens because a bin's test compares your samples against a wave that fits the block a whole number of times. A 5.5 Hz tone in a one second block ends halfway through a cycle. The block, repeated, would have a step in it and a step contains every frequency.
Why does an unfinished cycle produce a step?
Because the transform only ever sees the block, and everything it can express repeats with the block. Ask it to describe a tone that ends halfway up. The only thing it can build out of whole-cycle waves is a pattern that jumps back down when the block restarts.
A jump is a sudden change, and sudden changes need fast waves to build. So the transform includes a little of every frequency it has, right up to the top, in order to manufacture a corner it never wanted. That is why the far bars in Lab 16 are not zero.
Does this mean a spectrum of real audio is mostly wrong?
Mostly imprecise rather than wrong, and knowing by how much is the useful part. A tone landing between two bins reads up to about 36 per cent short, and the worst case is exactly halfway. Its true frequency lies somewhere between the two tallest bars. Both errors are bounded and both are correctable if you care: the two tallest bars can be compared to estimate where the tone really sits.
What is not correctable by arithmetic afterwards is a quiet tone buried under leakage from a loud one. That one has to be prevented, which is Step 9.
Can the true frequency be recovered from the two tallest bars?
Yes, to a useful accuracy, and instrument makers rely on it. The relative heights of the two tallest neighbours say where between them the tone sits: equal heights mean the middle, and four to one means much nearer the taller one. The arithmetic is a few lines and the name for it is interpolation.
It is how a guitar tuner reads to a tenth of a hertz off a block whose bins are a hertz apart. What it cannot do is separate two tones that have merged, because it assumes there is exactly one tone in the neighbourhood and reports nonsense, quietly, when there are two.
Taper the ends of the block, and pay for it
Leakage came from the block having a step in it when repeated. The fix follows from that: make the block end where it begins. Multiply the samples by a set of weights that are nothing at both ends and full in the middle. Whatever the signal was doing at the edges then fades out before the transform sees it. That set of weights is a window.
Three windows have been in use since the 1960s and all three are the same shape, a constant with a cosine taken off it. Hann is the plain one, Hamming is the same idea that does not quite reach zero at the ends, and Blackman adds a second cosine and tapers harder. Nothing about them is deep. They are eight or a thousand numbers you multiply by.
Does multiplying my samples by something not damage them?
It changes them, deliberately, and the damage is the price being paid. A windowed block is quieter overall, so the labs divide by the average weight to keep the bars comparable with the unwindowed ones. More importantly, the samples near the edges of the block have been thrown away. A signal that only happened at the very start of a block will be nearly invisible.
That is why real analysis overlaps its blocks. Run them half a block apart, and whatever the window faded out at one block's edge sits in the middle of the next. The spectrogram in Step 11 does exactly this.
Why are the windows named after people?
Because somebody worked out each shape and the name stuck. Julius von Hann was an Austrian meteorologist smoothing weather data in the nineteenth century, well before any of this was digital. Richard Hamming and Ralph Blackman were both at Bell Labs in the middle of the twentieth.
The names carry no meaning and there is nothing to remember about them. They are three particular sets of weights, and the full catalogue runs to dozens with names like Kaiser, Bartlett and flat top. Every one of them is a list of numbers you multiply your samples by.
So which one should I actually use?
Hann, unless there is a reason, and the reason is usually one of two. If a quiet thing near a loud thing matters more than anything else, go to Blackman and accept a wider main bar. If separating two similar things at nearly the same frequency matters more, use none and accept the leakage.
The honest summary is that there is no best window, because the two things a window trades cannot both be won. What somebody experienced actually does is work out which of the two the job needs, and that is a question about the signal rather than about the window.
The trade is worth stating plainly, because it is the reason there is no best window. A window buys freedom from leakage and pays in resolution. If you need to see a quiet thing next to a loud thing, window hard. If you need to separate two things at similar heights and nearly the same frequency, window lightly or not at all.
The shifts you discarded, and what they were holding
Every spectrum so far has been a row of magnitudes, and the shift column has sat there unused. Almost every spectrum you will ever meet does the same: it prints heights and throws the shifts away. That is usually the right decision and it is never a free one. This step measures what it costs.
Take the eight samples this course started with. Slide each of its two parts along by some amount, leaving both heights alone. The magnitudes come out identical, to fifteen decimal places, because magnitude is the hypotenuse and sliding a wave only moves the answer around the triangle. The eight numbers, meanwhile, are completely different.
If magnitude ignores the shift, what is the shift column for?
For putting the signal back together. The transform is reversible, and running it backwards needs both sums, which is the same as needing both the magnitude and the shift. Keep magnitudes only and the original samples are gone for good: you can build something with the same spectrum, but not the same wave.
Where that matters most is anything with a sharp edge in it. A drum hit, a consonant at the start of a word, a radar echo: all of those are a moment in time. A moment in time is stored entirely in the relationships between the shifts. Lose them and you keep the ingredients and lose the timing.
Shifted relative to what?
To the first sample of the block. A shift of 0 means the wave was at a peak when sample 0 was taken, and 90 degrees means it was a quarter of a cycle past that. It is a statement about the recording having started when it did, which is arbitrary.
What is not arbitrary is the shifts relative to each other. Move the whole recording along by one sample and every shift changes while the sound does not. Slide one part and leave the others where they are, and the shape changes completely, which is what Lab 21 does.
Where is the shift the thing you actually want?
Anything that measures distance by timing. A radar or a sonar gets range from how late the echo comes back, and late is a shift. Two microphones a few centimetres apart give the direction a sound came from, from the shift between them, which is how a phone keeps your voice and drops the room.
Radio goes further and uses the shift as the message. Several of the schemes in Modulation carry data by jumping a carrier between four or eight shifts. The column this step has been treating as a nuisance becomes the only one that matters.
The clearest case of all is a single spike. Its magnitudes are the same height at every frequency. So the magnitude spectrum of a click at the start of a block matches that of a click in the middle of it. Everything that says when the click happened is in the shifts.
Frequency against time, so a changing sound becomes a picture
One transform of a whole recording answers what frequencies are in it, and refuses to answer when. Two notes played one after the other and the same two notes played together give the same spectrum. For most real signals that is useless, because when is the entire content: speech is nothing but a sequence of changing frequencies.
The fix is what you would do anyway. Chop the recording into short blocks, transform each one on its own, and put the answers side by side. Time runs across, frequency runs up, and the height of each bar becomes the darkness of a cell. That picture is a spectrogram. It is how anybody who works with sound actually looks at it.
Why overlap the blocks instead of laying them end to end?
Because of the window from Step 9. A window fades out the samples at each end of its block. A short event landing on a boundary would be faded out of both blocks it touches and appear nowhere. Running the blocks half a block apart means every sample sits in the middle of some block.
Overlapping costs work, and it is the usual arrangement anyway: a half-block hop doubles the number of transforms and is the standard choice. Step 12 is about why doubling the number of transforms stopped being a serious objection.
Why does a steadily rising tone look like a staircase?
Because both directions are chopped up. The tone rises smoothly, and the picture has one column per block and one row per bin, so a smooth rise gets rounded onto whichever cell is nearest. A finer staircase needs more rows or more columns, and Lab 23 shows that you cannot have both.
It is the same effect as a photograph having pixels. Nothing is wrong with the analysis, and the tone really is somewhere inside each cell it lights up. What the picture will not tell you is where inside.
Is this the same picture a music program shows me?
Yes, and two things about the usual presentation are worth knowing. The vertical axis is normally spaced by doubling rather than by adding, so each octave gets the same amount of room, because that is how pitch is heard. And the darkness is normally in decibels, so a detail one thousandth the height of the loudest thing is still visible.
The grids in these labs do neither, on purpose. The rows are evenly spaced in hertz, and the digits are plain fractions of the loudest cell. What you see is what the transform said, with nothing applied on top.
Chopping into shorter blocks buys time detail and sells frequency detail, because bin width is one over the block length. That is the same trade as Step 7, arriving in a place where you can see both halves of it at once.
Count the multiplications, then halve the problem
The transform as built in Step 5 does two multiplications per sample per frequency. Eight samples means eight frequencies to test and eight products in each of two sums, which is 128 multiplications for one transform of eight numbers. Double the block and it does not double: 16 samples take 512, because both the number of frequencies and the length of each sum went up.
That is the pattern worth having a name for. When the work goes up with the square of the block length, a block ten times longer costs a hundred times as much. A thousand samples costs two million multiplications, and a spectrogram wants one of those every few milliseconds.
The saving comes from one observation. Split the eight samples into the four at even positions and the four at odd positions. Transform each four on its own, which costs 32 multiplications each rather than 128. Then combine the two answers, which takes one round-the-circle multiplication per output pair, and each of those is four ordinary multiplications. Two smaller transforms plus a combining step beats one big one. The trick works again on each half, and again, until the pieces are one sample long and nothing is left to do.
What does "the number of halvings" mean, and is it a logarithm?
It is how many times you can halve the block before you get down to one sample. Halving 1,024 gives 512, then 256, and so on down to 1, which is ten halvings. Eight takes three. It is a small number and it grows very slowly: doubling the block adds one to it.
And yes, that is exactly what a logarithm to base two is. The fast transform's cost is usually written as the block length times the logarithm of the block length. The word is doing no work that counting halvings does not do, which is why this step counts instead.
Who worked this out, and why is it treated as such a big deal?
James Cooley and John Tukey published it in 1965, and it turned out that Gauss had the same idea in about 1805 and left it in an unpublished notebook. Their version is called the fast Fourier transform, or FFT. It computes exactly the same answer as the slow one. It is not an approximation.
It gets called one of the most important algorithms of the century because it moved a whole class of work from impossible to routine. Analysing a second of audio in one second stopped being a research problem. Everything downstream, from digital telephony to medical scanners to the wireless standards a phone uses, assumes it is cheap.
Does the fast one give a slightly different answer?
No, and that is the remarkable part. It is a rearrangement of the same multiplications and additions rather than an approximation to them, so no accuracy is being traded for the speed.
The two transforms behind this course are checked against each other on the same signals, and the largest disagreement between them is about one part in a thousand million million. That is the ordinary rounding of the arithmetic and not a difference of method.
Pick the right Fourier tool for the data you hold
Everything so far has been one tool, the DFT, which eats a finite list of samples. The word Fourier actually names a small family of tools, one for each kind of data. All of them answer the recipe question from Step 0. They differ only in what they assume the signal to be.
A smooth curve that repeats for ever has a Fourier series: a recipe with numbered ingredients, its harmonics. A smooth curve that never repeats has the continuous Fourier transform, whose recipe holds an amount at every frequency, not just at whole numbers. An endless list of samples has the DTFT, short for discrete-time Fourier transform. A finite list of samples has the DFT you have been using, and the FFT from Step 12 is not a fifth tool. It is a fast way of computing the fourth one.
One fact holds across the whole family. It is worth meeting as a picture before any lab uses it. A short event needs a wide recipe, and a long steady event can make do with a narrow one. Squeeze a pulse in time and its frequency content spreads out. Stretch it and the content gathers in. The two widths trade against each other, always.
The family matters because using any of them is a claim about your data. Transform a finite block and you have silently claimed that the block repeats for ever. The leakage in Step 8 was the bill for that claim arriving. Naming the assumption is what lets you predict the bill.
Why does squeezing a pulse widen its recipe?
Because telling frequencies apart takes time. Two tones that differ by one cycle per second only drift apart by a whole cycle after a full second. A pulse a quarter of a second long ends before the drift shows, so waves across a wide band all fit it about equally well. The transform reports that honestly: a wide band of ingredients.
This is Step 7's rule wearing different clothes. Bin width was one over the block length, and a short pulse is its own short block. Nothing about the arithmetic changed, only the name on the picture.
Where do the Laplace and z-transforms fit?
The Fourier family asks one question: how much steady wiggling at each rate. The Laplace transform asks a wider one. It allows ingredients that grow or die away as they wiggle, so it can describe a system settling down, or running away, not just one holding steady. Control Systems leans on it for exactly that reason.
The z-transform is the same widening for sampled signals, and the DTFT sits inside it as the special case where nothing grows or dies. You do not need either one to read a spectrum. You will meet both the moment you ask whether a filter is stable.
The family map also settles the most tempting shortcut in the subject: padding a block with zeros to get more bars. The zeros do lengthen the list, so the bars land closer together. What they cannot do is add information, because the zeros were not measured. The extra bars are a smooth curve drawn through the answers you already had.
Turn the two sums into one turning arrow
Every bin so far has been a pair of numbers: a cosine total and a sine total, drawn as the two short sides of a right-angled triangle. There is a second picture of the same pair, and the rest of engineering is written in it. Draw an arrow out from the centre of a clock face. Give it the magnitude as its length and the shift as its angle. The cosine total is that arrow's shadow on the floor. The sine total is its shadow on the wall.
A pair of numbers handled as one arrow has a name: a complex number. The horizontal shadow is called its real part and the vertical shadow its imaginary part. Both names are historical accidents and neither is a comment on reality. Nothing imaginary happens anywhere: the arrow is two ordinary sums stapled together so that they travel as one thing.
The arrow earns its keep when things move. Slide the wave along, as Step 10 did, and the two sums change in a complicated see-saw while the arrow simply rotates, keeping its length. The magnitude spectrum that would not move in Lab 20 is the picture you get by recording only the arrow lengths and letting the angles go.
Where does the famous e to the j theta come in?
Textbooks write the arrow at angle theta as e^(jθ), and the statement that this
equals cos θ + j sin θ is Euler's relation. You can read that whole expression as
pure notation: "the unit arrow at angle theta", floor shadow cosine, wall shadow sine. Nothing in
this course needs more than that reading.
What the notation buys is compact bookkeeping. One symbol carries both sums, and the rules for combining arrows come out of the ordinary rules for combining symbols. It is shorthand that turns out to do arithmetic for you, which is why every textbook adopts it on page one.
Step 4 said the imaginary part carries a minus sign. Why?
Convention, and only convention. The standard DFT tests each frequency with an arrow turning clockwise, so the sine shadow it records is the negative of the plain sine total this course computes. The magnitude is a length either way, and lengths do not care about the direction of turning.
It matters exactly once: when you hand-check a course number against a library such as NumPy, expect the sine part to come back with its sign flipped. The cosine part and the magnitude will agree to rounding error.
What happens when two arrows are multiplied?
The lengths multiply and the angles add. That single rule is why the arrow picture took over the subject. A filter scales each ingredient and slides it, which is exactly a length multiplied and an angle added. So passing a signal through a filter becomes one arrow multiplication per bin.
Step 15 uses that rule to move a whole filtering job into the frequency domain and back. Doing the same with separate cosine and sine sums is possible and miserable: four multiplications and two additions per bin, arranged in a pattern nobody remembers.
Keep an honest account of the energy
Square each of your samples and add the squares up. That total is the signal's energy, and squaring is what makes it honest. A swing to minus 2 works the air as hard as a swing to plus 2, and squaring counts both as 4. Loud signals have big energy, silence has none, and no clever shifting of parts can change the total.
Now do the same on the other side of the transform. Square each bin's magnitude, add them up, and divide by the number of samples. You get exactly the same total. That is Parseval's theorem, and it says the transform neither creates nor destroys anything. It only re-sorts the signal into ingredients, the way pouring flour into labelled jars changes no flour.
This sounds like a curiosity and is actually a working tool. Transform code is riddled with scaling choices: divide by the sample count, or by half of it, or not at all. Run the energy account on both sides and a wrong scale announces itself as a mismatch, before it quietly corrupts every number downstream.
The arrow rule from Step 14 pays off here too. A filter, in frequency terms, multiplies each bin's arrow by its own arrow: length times length, angle plus angle. So a long, slow filtering job in the time domain can be done as transform, one multiplication per bin, and transform back. The sliding weighted average that a filter performs sample by sample has a name, convolution, and this route computes it wholesale. For long filters it is enormously cheaper, and the saving rides on Step 12's fast transform.
Why does filtering through the transform need padding with zeros?
Because the DFT treats its block as repeating, from Step 13. Multiply two unpadded transforms and the filtered output that should slide off the right-hand edge wraps round to the left. The start of the block gets corrupted with the end of it.
The fix is room: pad both lists with zeros until the block is at least as long as the two lengths added, less one. Then the wrap lands on zeros, harming nothing, and the answer matches the honest sample-by-sample version exactly.
Is energy here the same energy as in physics?
It is proportional to it, for the signals a sensor hands you. A loudspeaker driven by twice the voltage pushes with twice the force through twice the motion. The power goes up four times, which is the square showing up in the physics too. Engineers borrow the word with a clear conscience.
The proportion matters when the units do, which is Step 16's whole subject. Within one signal, though, the squared total is a fair loudness account whatever the units are, and that is all Parseval's theorem needs.
Does the energy account see the shifts that magnitude discards?
No, and that is worth noticing. Each bin contributes the square of its magnitude, and magnitude ignores shift, so the aligned and scrambled harmonics of Lab 21 carry identical energy. Your ear agreed: they were equally loud and differently shaped.
So the account can vouch for a transform's scaling and still say nothing about its phases. A code check built only on Parseval's theorem would pass a library that mangled every shift. That is why test suites also transform a known shifted wave and read the angle back.
Put units on a spectrum, and error bars on your trust
Every bar in this course so far has been an amplitude in the same units as the samples: volts if the sensor speaks volts, pascals for a microphone. That is one honest choice among three. Square a bar and you have power per bin, in squared units, which is the energy account of Step 15 read bin by bin. Divide that by the bin width and you have power spectral density, shortened to PSD: squared units per hertz, the standard way measurement gear reports noise.
Density earns its place when block lengths differ. Halve the bin width and each bin catches half the noise power, so the per-bin bars all drop, while the density stays put. A bar without its unit is therefore unfinished: the same physical noise can be drawn three different heights, and only the label says which drawing you are looking at.
Noise brings a second problem: one block is not enough. Transform one block of a hissy signal and the spectrum of that single block, called a periodogram, comes out wild, each bar dancing far from the true level. The repair is honest averaging. Welch's method cuts the recording into overlapping windowed segments, transforms each, and averages the powers. More segments mean a steadier estimate. Shorter segments mean wider bins. You are trading resolution for confidence, the same currency as ever.
Why does averaging steady the estimate at all?
Because noise disagrees with itself. Each segment's periodogram is the true level plus a random error, and the errors in different segments point in different directions. Averaging lets them cancel, so the average settles towards the true level as more segments join in.
The settling is slow: cutting the scatter in half takes four times the segments. That square root is the price of confidence throughout measurement, and it is why long noise measurements take minutes, not milliseconds.
Amplitude, power and energy signals: which applies when?
A finite event, a hand clap, has a finite energy total, and energy per hertz is the natural density for it. A signal that runs indefinitely, background hiss or the mains hum, has unbounded energy but a steady average power, so power per hertz is the honest measure. The two densities answer different questions and carry different units.
Calibration decides whether either number means anything physical. A vibration lab keeps a note of the sensor's volts-per-unit figure with every recording. A PSD in volts squared per hertz is only an acceleration statement if that link survives.
Measure what a physical system does to each frequency
Filters taught the habit of pushing one sine into a thing and measuring what comes out. Spectra let you do every frequency at once. Record the input to a system and its output at the same time, transform both, and compare them bin by bin. Each bin answers two questions: how much did this frequency get scaled, and how far did it get delayed. That per-frequency answer sheet is the system's transfer function, written H(f): its gain and its shift at every frequency.
A pure delay has a tell worth memorising. It scales nothing, so the gain sits flat at 1, and it shifts every frequency by the same time, which is more cycles for faster waves. So its shift falls along a straight line as frequency rises. Instruments exploit that in reverse, reading a system's delay off the slope of its measured shift.
Real measurements add noise, and dividing one noisy spectrum by another multiplies the mess. So practical instruments average many blocks, and they report one more number alongside the transfer function: coherence, a score from 0 to 1 per frequency. It asks how much of the output at that frequency moves in lockstep with the input. High coherence means the transfer estimate there stands on evidence. Low coherence means noise, an unmeasured second input, or a system that is not behaving linearly, and the estimate at that frequency should not be trusted.
What does a trustworthy measurement session look like?
Drive the system with an input that contains every frequency you care about, without pushing it so hard it stops behaving linearly. Record input and output on one shared clock, since a clock difference masquerades as delay. Average repeated runs, inspect the coherence before believing any bin, and write down the settings beside the data.
Then test the estimate against a different input than the one that built it. A model that only predicts the recording it was fitted to has memorised, not measured, and Step 20 meets the same rule again wearing machine-learning clothes.
Why would a system stop behaving linearly, and what does that do here?
Push most physical things hard enough and their response stops being proportional: an amplifier clips, a spring stiffens, a loudspeaker cone hits its limit. A clipped sine is no longer a sine, and the extra corners are new frequencies the input never contained.
The transfer function has no row to file those under, since it only maps input frequencies to themselves. The energy leaking into new frequencies drags coherence down, which is exactly the warning light behaving as designed: turn the drive level down and measure again.
Survive samples that arrive unevenly, or not at all
The DFT's quietest assumption is the metronome: every sample exactly the same time after the last. Real data breaks it constantly. A telescope observes when the sky is clear. A wireless sensor drops packets. A logger writes a reading when something happens, not on the tick. Feed such data to a DFT as if it were even and the arithmetic runs happily, on a signal that was never measured.
The damage has a shape worth knowing. A sample taken late is a sample of the wave further along its cycle, so timing error becomes shift error, and the same lateness costs more cycles at higher frequency. A microsecond hardly moves a 10 Hz reading and mangles a megahertz one. Slow signals forgive sloppy clocks. Fast ones do not.
The honest repairs all start the same way: keep the timestamps. Small jitter can be repaired by resampling onto an even grid, with the interpolation model written down. Bigger irregularity has purpose-built tools. The Lomb-Scargle method, named after its two inventors, asks Step 4's sine question at the times you actually measured, no even grid required. What no method can do is conjure the samples that were never taken.
Why is smoothly filling every gap actively dangerous?
Because a smooth interpolator is a promise that nothing interesting happened, inserted into the data as if it were evidence. A fault transient that struck inside the gap is replaced by a polite curve, and the filled record then looks cleaner than the machine it came from.
The defence is stated doubt: analyse with two different plausible fills, or with the gap simply cut out, and report which conclusions change. A conclusion that flips with the fill was resting on the guess, not on the measurement.
Who actually meets this problem?
Astronomers most famously: a star's brightness sampled only on clear nights, with the daytime a built-in gap, which is why the Lomb-Scargle method grew up in astronomy. Their gaps even manufacture fake frequencies, ghosts spaced at one cycle per day, that a naive spectrum reports as real.
Closer to this stream: battery sensors that report on change to save power, networks that drop packets, event logs stamped when software got round to writing them. Any spectrum computed from such records is only as honest as its treatment of the timestamps.
Read an image as frequencies across space
Nothing in the recipe idea mentions time. Take any line of pixels across a photograph and you have a list of brightness numbers, a wave in space rather than in time. Frequency becomes spatial frequency: how many times the brightness cycles per pixel travelled. Slow rolls of shading are low spatial frequencies. Fine textures and sharp edges are high ones.
An image runs in two directions at once, so its transform does too, comparing the picture against striped patterns at every spacing and every angle. One clean set of stripes in the image becomes a pair of bright points in the spectrum, mirrored through the centre, the same mirror pairing Step 6 measured. The pair sits along the direction the brightness changes, which is across the stripes, not along them. Closer stripes push the pair further out.
Editing the spectrum edits the picture. Keep only the points near the centre and fine detail vanishes: a blur. Remove the centre and keep the edges of the spectrum and only fine detail survives: an edge-finder. Delete one offending pair of points and a periodic nuisance, scanner stripes or sensor interference, lifts out of the photograph while everything else stays. That targeted deletion is called notching, and it has no counterpart as clean in the pixel domain.
Do real imaging machines actually work in the spectrum?
Some are built there. An MRI scanner records its measurements directly as points of the image's spatial spectrum, and the photograph of your knee is one inverse transform later. The machine's operators talk about filling in the spectrum the way photographers talk about exposure.
A camera lens does it in glass: it cannot pass stripes finer than its aperture allows, so it is a physical low-pass filter. Its blur is the gentle kind a gradual mask predicts. Diffraction, telescope resolution and audio filtering are one mathematics wearing three costumes.
Does the idea stretch beyond flat pictures?
To three dimensions and beyond. Volume scans, simulated weather, and the pressure field around a wing all have spatial spectra. The transform's favourite trick still works there: taking a derivative, which is the slope of a field, becomes multiplying each ingredient by its own frequency.
Solvers for the equations of physics exploit that, doing calculus as multiplication in the spectrum at fast-transform prices. The method is superb while the field is smooth and repeats at the edges, and it inherits every assumption this course has priced, leakage included.
Feed spectra to learning machines without fooling yourself
Machine learning systems that listen, to speech, to machinery bearings, to heartbeats, rarely eat raw samples. Most eat some version of Step 11's picture. The spectrogram's formal name is the short-time Fourier transform, or STFT, and a complex STFT is one that keeps each bin's full arrow rather than just its length. Two further dressings are common. A log spectrum squashes the heights so quiet detail stays visible next to loud. Mel bands merge bins into wider bands going up in pitch steps matched to human hearing, named after a scale of melody.
Which dressing to use is an engineering decision, not a fashion. The rule that decides it is the one this course has been building: keep what the answer depends on. Discarding the arrows' angles, as every magnitude picture does, throws away timing within a cycle, which Step 10 showed is the shape of the wave. Fine for naming a vowel. Ruinous for a system that must rebuild or align the waveform it heard.
The transform has also moved inside the models. A Fourier neural operator is a learned simulator for fields: waves, heat, weather-like flows. It works by transforming the field to its spatial spectrum, mixing a limited number of ingredients with learned weights, and transforming back. Trained well, it answers in milliseconds where a classical solver takes hours. It remains a fit to its training data: outside what it saw, it can be confidently and smoothly wrong.
What are the standard tools for all this, as of 2026?
NumPy, SciPy and PyTorch all ship fast transforms, real-input variants, and explicit scaling options, and SciPy adds Welch averaging, coherence and Lomb-Scargle under those names. The conventions differ between libraries in exactly the ways Step 15's energy check catches, so run it once per library rather than assuming.
The Fourier neural operator paper is the readable origin of the learned-solver idea. Reproducing its comparisons on your own geometry, before trusting them, is the same habit as validating a transfer estimate on a fresh input.
Is a spectrogram front end old-fashioned now that models can eat raw audio?
No. End-to-end models that learn their own front end sometimes win, given oceans of data. Their first learned layer routinely turns out to resemble a bank of frequency filters anyway: the model reinvents the ear. With modest data, a fixed spectral front end is often the stronger and cheaper choice.
The honest comparison is measured, not argued: same task, same held-out data, both front ends. What this course adds is knowing what each representation discarded, so a mysterious failure can be traced to a missing ingredient rather than to bad luck.
Your own eight numbers, and nothing marked
Everything in this course is in one place here, with no goal and no verdict. Build a signal out of up to three parts, choose how long the block is and how fast it was sampled, pick a window, and read the spectrum it produces. The multiplication count for the transform being displayed is printed with it.
Four things are worth doing on purpose before you leave. Put a part at a frequency above half the sample rate and find where it comes back. Set two parts a fraction of a bin apart and watch them refuse to separate. Move a part off a bin and turn a window on. And set every part to the same frequency with different shifts, and see what one bar can be made of.
What comes after this course?
Advanced work derives transform pairs with calculus, studies distributions such as the impulse, and designs perfect-reconstruction filter banks. It uses wavelets and reassigned time-frequency methods, and solves inverse problems where the measured spectrum is incomplete or noisy.
The engineering habits here still apply: write the transform convention, preserve units and timestamps, state boundary assumptions, and measure uncertainty. Test a reconstructed or predicted result against data that was not used to produce it.
How do I know a spectrum I am looking at is telling me the truth?
Ask the four questions this course has put numbers on. How long was the block, which fixes the bin width and therefore what could possibly be separated. Was a window used, which decides whether a quiet bar is real or is leakage from a loud one. Is the interesting bar sitting on a bin or between two, which decides whether its height can be trusted to better than about a third. And is anything above half the sample rate, which will have folded down and be sitting on top of something innocent.
Four questions, and you can answer all of them from the settings rather than from the picture. Most misread spectra are misread because nobody asked the first one.
What does each control change?
The three parts each build one cosine, and they are added together to make the signal. Each part has a frequency in hertz, a height in the same units as the samples, and a shift in degrees. Setting a height to zero switches a part off. The samples in the block and the sample rate together fix the bin width and the block length in seconds.
The window multiplies the samples before the transform, and the readings are divided by the window average so that a windowed bar is comparable with an unwindowed one. Everything else on the panel is measured from the result, including the multiplication count, which comes from a counter inside the transform.
What you can do now
- Say what the frequency domain is: the recipe view of a signal, an amount and a shift for each pure wiggle, with the equaliser as its everyday picture.
- Work out one bin of a transform by hand: multiply the samples by a cosine, add up, do the same against a sine, and take the hypotenuse.
- Say why there are two sums per frequency and not one, and what the second one catches.
- Turn a magnitude into an amplitude in the units of the samples. Say why the divisor is half the sample count for most bins and the full count for two of them.
- Read a spectrum: bin number, frequency in hertz, magnitude and amplitude, and know which half of it to ignore.
- Work out the bin width from the sample rate and the block length, in either direction. Say how long a recording has to be to separate two frequencies a known distance apart.
- Recognise leakage from its fingerprint, two nearly equal neighbouring bars with a dusting everywhere else, and say how far the peak height can be trusted.
- Choose a window on purpose, knowing that it buys freedom from leakage and pays in resolution, and name a case where the right choice is none.
- Say what magnitude alone loses, and what a signal rebuilt from magnitudes only will sound like.
- Choose a spectrogram's block length to match the event you are looking for, and say what that choice costs in frequency detail.
- Explain, by counting rather than by quoting, why the slow transform costs the square of the block length and the fast one costs the block length times its halvings.
- Distinguish Fourier series, continuous transform, DTFT, DFT and FFT, and explain why zero padding does not improve true resolution.
- Use complex rotation to interpret DFT bins, check energy with Parseval, and explain why frequency-domain convolution needs padding.
- Label amplitude, power and PSD with correct units, and choose Welch segment length and overlap with an explicit resolution-versus-variance trade.
- Estimate a transfer function from paired input and output measurements, and use coherence to find frequencies where the estimate is not trustworthy.
- Handle irregular or missing samples without discarding timestamps, and read spatial frequency in an image or field.
- Choose a spectral representation for a learning task and gate a learned spectral solver with coverage, task error and physical residual checks.
- Ask the four questions that decide whether a spectrum somebody hands you means what they say it does.
Where this goes
- Modulation. Putting data on a carrier is done by changing its height, its frequency or its shift, and reading it back is a transform per symbol. The shift column that Step 10 kept becomes the data itself.
- Software-Defined Radio. A radio that is mostly arithmetic runs transforms continuously. The count from Step 12 decides whether a given band can be watched at all on a given processor.
- Filters. The frequency response measured one sine at a time in that course is a transform of the filter's impulse response, so everything measured there can now be computed instead.
- Machine learning. Spectrograms, complex STFTs and learned waveform front ends are alternative representations whose value must be measured on the downstream task.
- Computer Vision. Two-dimensional spectra explain spatial filtering, periodic interference and part of the geometry behind modern imaging systems.