## “The Theory and Technique of Electronic Music” – Miller Puckette, Chapter 1

Hey folks! I recently came across the phenomenal book, available for free online, “The Theory and Technique of Electronic Music” by Miller Puckette, renowned designer of Pure Data the open-source cousin Cycling ’74’s famous Max/MSP environment. It’s a fascinating subject and I highly recommend checking it out here! I wont lie, a lot of this book has the tendency to go straight over my head in a lot of places if I don’t read and reread sections of it, so I’m doing the exercises here, publicly, so that I can hopefully make sense of what Mr. Puckette is saying and to maybe elicit feedback and correct the places where I’m not understanding some of the mathematics and relationships being presented, since there’s no answer key given. I’ll attempt to work through the answers in as long a form as possible to break it down to the simplest level and explain/show all of my work along the way.

Though the book appears to be geared more toward using the concepts in the context of PD or Max, I’m more interested in more wholly understanding digital audio, so just for the heads up: somewhere down the line, I may skip a PD-centric question or two ðŸ™‚

## Ladies and Gentlemen, what you’ve all been waiting for: Tons of math!

1. A sinusoid has initial phase and angular frequency . What is its period in samples? What is the phase at sample number n=10

The first thing to identify in this question is that we’re talking about a sinusoid, which always has a period (in samples) of . If the angular frequency is , then the period in samples, whose formula is given in the book as period is equal to , is filled in with the variables given as: . Solving this fraction the old fashioned way then becomes pretty simple:

The second part of the question means understanding that a sinusoid is a repeating sine wave (measured in radians) and completing its cycle over the course of it’s period – which, in this case, has been determined to be twenty samples. Ten samples into its cycle is halfway through it, so the phase is from it’s initial phase. In practice, at least for the case of sinusoids, this puts that particular sample directly on the zero crossing between positive and negative amplitude ranges.

2. Two sinusoids have periods of 20 and 30 samples, respectively. What is the period of the sum of the two?

~~I’m possibly going out on a limb here but this is quite simple: The period of the sum of these two sinusoids is simply the least common multiple of the two periods, which in this case would be 60 samples.~~

As pointed out by a commenter, indeed, the period of the sum of two sinusoids is simply the period of the larger wave. The answer is 30 samples.

3. If 0 dB corresponds to an amplitude of 1, how many dB corresponds to amplitudes of 1.5, 2, 3, and 5?

In the book, decibels are set up so that where is decibels, is the amplitude while is a reference amplitude to which the first is being measured. The book notes that an “increase in amplitude by a factor of two corresponds to an increase of about 6.02 decibels.” We can already surmise that if our reference amplitude () is 1, which corresponds to zero dB, then we should see the math resulting in 6.02dB when the amplitude is 2.

Simple calculation of the formula plugging in the data results in the following formulae and results:

which falls in line with the given supposition.

4. Two uncorrelated signals of RMS amplitude 3 and 4 are added; whatâ€™s the RMS amplitude of the sum?

Puckette, on the matter of adding together signals, states that the power of the sum of the Root Mean Squares of two signals is the sum of the powers. Does that sound familiar to anything you’ve ever learned before…? The answer can be defined as …More specifically, on the issue of *correlation* between signals, they can be thought of as being related by the Pythagorean relationship: “uncorrelated signals can be thought of as vectors at *right angles* to each other; positively correlated ones as having an *acute angle* between them, and negatively correlated as having an *obtuse angle* between them.” So how do we solve for the amplitude of the sum?

, or….

As an aside, Puckette only briefly touches on how correlation can change relationship between RMS of the original signals and the sum. We know from high school math that the Pythagorean Theorem only works on right triangles, my curiosity wants to ask what if they *were* positively or negatively correlated signals? How does this change the math involved? Hopefully Puckette (or anyone reading this!) answers this down the road. He invokes a specific formula on page 11, but it goes way over my head, so I just listen, smile, and nod along to it.

5. How many uncorrelated signals, all of equal amplitude, would you have to add to get a signal that is 9 dB greater in amplitude?

This had me stumped for a while until I saw someone else’s method for solving this posted online, but I thought to simplify it and explain it in more detail. Even he seems unsure but I trust the answer after following my own intuition and what I already know about audio from practice.

Earlier we used the equation set up to calculate decibels as , using amplitude and now we can reverse the process. We know we want to reach a decibel level of 9 against an arbitrary reference level so we need to find . In this case, the math breaks down like this:

So we now know than an amplitude of will give us an increase of 9dB.

We also know that uncorrelated signals follow a Pythagorean relationship. So for 2 uncorrelated signals of equal amplitude the amplification multiplier is sqrt(2).Â Though Puckette never says as much, it’s not unreasonable to assume that for 3 uncorrelated signals of equal amplitude, the amplification multiplier of , is sqrt(3). Following that train of thought, all we need to do is find out when . Let’s knock it out:

So the correct answer is (hopefully – remember, there’s no damn answer key here) .

Does that look right…?

6.Â What is the angular frequency of middle C at 44100 samples per second?

The book gave away the real-time frequency of Middle-C at 261.626 Hz, but let’s pretend I didn’t read that and use the MIDI to Frequency conversion formula that Puckette provides, which is , where is the MIDI number we want to convert, (which in this case, is 60). Filling in the variables, frequency is equal to

Cool. So now that we’ve got the frequency of the note we need to convert this to the *angular** frequency* of the note. A sinusoidal signal with an angular frequency of and sample rate of has a real-time frequency equivalent to:

.

7. Two sinusoids play at middle C (MIDI 60) and the neighboring C sharp (MIDI 61). What is the difference, in Hertz, between their frequencies?

Let’s hit up that same equation I used in the last example to convert midi to frequency for both of these MIDI notes:

Then just subtract the two for the answer:

It don’t get quicker than that!

8. How many cents is the interval between the seventh and the eighth harmonic of a periodic signal?

So, this took a lot more time than I thought it would. The problem that we’re faced here is that the original signal is of a completely arbitrary frequency. Surely, every signal with a different frequency will have different overtones at different frequencies…But if we look a bit closer to the question, Puckette is asking about *cents*. It always takes 100 hundred cents to create a half-step between any two notes. It doesn’t matter what two notes you’re measuring the interval between, a half step is always 100 cents, even if the frequencies are dozens of hertz apart, like at the top register of the piano or high-pitched piccolo flute. So how many cents are between the seventh and eighth harmonic? Let’s remember that the overtone series (the harmonic series) is represented by a series of extremely simple ratios: 2:1, 3:2, 4:3, 5:4, 6:5, 7:6, 8:7 (!), and so on.

At this point I became stuck again, honestly. I knew I needed to somehow coax the number of cents between 8:7 but I couldn’t quite seem to figure it out. It was time to google and after much (re?)learning about the Twelfth Root of Two, a formula useful for finding the difference between half-steps. It’s most often used to calculate the frequencies of notes relative to one another (ie: if you’re trying to find the frequency of a note five half-steps above, say, A-440 – which is a D, you would use the twelfth root of two as so: which equates to . Cool, but we’re not looking for frequency…we are however looking for the amount of half-steps it takes to create the fraction .

So….

Literally the only reason I can safely say that this is correct is because the book gives the amount of cents above a given fundamental for various parts of the overtone sequence and subtracting the seventh from the eighth gave the same number. I feel icky right now after this one.

9. If an audio signal x[n],n = 0,…,N âˆ’1 has peak amplitude 1, what is the minimum possible RMS amplitude? What is the maximum possible?

This is a completely theoretical question. It’s sort of given away in the reading but let’s talk for a second: The Root Mean Square amplitude of a signal may equal the peak amplitude of a given window of samples, *but never exceed it*, and it may be as little as but *never be less than that*. So that’s our answer. If the peak amplitude is 1 in the given sample range, then the maximum possible RMS amplitude is 1. Likewise, the minimum is constant: where is the size of the given range of samples in the signal.

…I can’t believe this was only chapter one. It might have to be a minute before I can work up the nerve to tackle whatever Chapter 2 has in store. (But seriously, I learned a ton here about working with frequencies so I really can’t wait to get into Chapter 2.)

Answer 2: I believe is 30 samples, not 60.

If you refer to 1.7 Periodic Signals; on page 12 and the diagram on page 13 – it shows the summed wave having the same period as the wave with the largest period.

Thanks for making this post!

ðŸ™‚