The Little Vulgar Book of Mechanics (v0.3.0)

Last updated: February 3rd 2022

Just added this new section to the book.

Fourier Transform I #

At all times, I want you to think "We want to build an equalizer. That's is the point of what I'm reading." Literally, at all points, remind yourself that our goal is to build an EQ.

So here we go, a quick Fourier primer:

  1. We start with a waveform.
    1. I.e. The sound we're gonna fuck with.
    2. I.e. Your death metal riff.
  2. As a mathematical object, the waveform is a function.
    1. It is a function of time.
    2. Think of time as the horizontal axis on the plane.
    3. Just think of time going left to right, like in a DAW.
  3. Let's call the waveform s(t), like the mathematicians do.
    1. Using the letter "s" cos of the "signal" concept.
    2. Using the letter "t" cos time.
  4. Where we're heading: We're going to extract information from s(t).
  5. Before some programmers confuse themselves and others:
    1. Neither of these two programming notions will help you: "Functions are first class, bro" (FP). Or "everything is a object, so a function is just another object!" (OOP).
    2. E.g. function f() { } let x = f and then you say "x is a function."
    3. E.g. let square = new Function(x => x * x); and then you say "the function square is an object, like everything else!"
    4. Don't bring any of that programming language shit here. It's not helpful here.
  6. To the mathematician, the function is the whole thing. The graph. The table. However you visualize it.
    1. I.e. the function is all the inputs with all their respective outputs.
    2. Bringing that to programming: A collection of pairs [ [1, x(1)], [2, x(2)], ..., [1000, x(1000)] ].
    3. Pairs of inputs and outputs.
    4. That is (our programmer translation of) the function as a mathematical object.
    5. (Of course, the mathematician thinks of it with infinitely many inputs, going infinitely to the left and right in the time domain, infinitely infinite between any two numbers, and blablabla. They can't control themselves, with their Infinity nonsense.)
  7. Aside on why we named the waveform s(t).
    1. "s" because "signal" (Information-wise. Put on your "Signal Processing" engineer hat.)
    2. "t" because it's a "function of time."
    3. "Function of time" = time is the input, and the x-axis on a graph.
    4. (Btw the vertical axis here is gonna be telling us the amplitude.)
    5. Have you seen audio and sound tools referring to "DSP"? That stands for "Digital Signal Processing."
    6. Your death metal riff, i.e. our waveform s(t), is the signal we'll be digitally processing here.
  8. Stop here and remember: We're walking towards the data we would need to build an EQ.
  9. Enter Fourier: From a clever analysis of s(t), we can synthesize two sinusoids of different frequencies.
    1. (Two or more, of course. But think two for now. As a minimal non-trivial mental picture.)
  10. I.e. we "decompose" big fat s(t) into two thin sinusoids of different frequencies and amplitudes.
    1. In practice: It's an algorithm. Put on the programmer hat. It's just a fucking algorithm.
    2. (Of course, in the real world it's actually various algorithms, for different practical purposes.)
  11. The sinusoids, if added back together, untouched, would give us the original waveform back.
    1. I.e. the analysis gives us a "lossless" decomposition of s(t) into its "building blocks."
    2. (By "lossless" I mean as a mathematical principle.)
    3. (Nothing is really "lossless" in practice, except for a copy operation on a digital file.)
    4. In the real world, "lossless" processing = "Rounding errors during computation were not too bad."
  12. Remember s(t) is the waveform. The whole thing. The audio recording.
    1. The mathematician does not mean a "return value" of "calling s" with a t, when he tells you "Let's analyze s(t)"
    2. He means analyze whole thing. The whole signal. Which he refers to as "s(t)" (and pronounces "s of t.")
  13. Anyway, computationally: After analysis, we get two "collections of amplitudes." The data for the two sinusoids.
    1. Think 300Hz = [ ... ], 1Khz = [ ... ].
    2. I.e. Separate amplitude data for the "children waves/signals/sinusoids" of the big wave s(t).
  14. Now we can step through, and mess around with, the amplitudes of each sinusoid.
    1. We can step through them, individually, in time
    2. (Not the original t, obviously. That's the time when we recorded. Not that time. But, say, the timeline in your DAW, now during mixing mode.)
    3. Programming speak: We'll step through them using an index in the collection of amplitudes.
    4. (And likely some arithmetic involving the "sampling rate" of the recording and shit. But let's talk about that later.)

This is just getting started with the intuition of the Fourier Transform. The next section will continue the story at this intuition level. And then I'll get more into the math. But at this point, you should already understand why this is the basis that lets us e.g. build an EQ (or any other form of processing.)