On The Mathematics of the Sine Wave

y(x) = A*(2πft + ø)

Why the understanding the sine wave is important for computer musicians

The sine wave is mathematically a very simple curve and a very simple graph, and thus is computationally easy to generate using any form of computing, from the era of punch cards to the current era of microprocessors. It is a simple x-y plot, with the x-axis representing time and the y axis represents displacement from zero.

Sine waves are important to music for several reasons:
            a)  For almost any simple physical system, if the system is disturbed from equilibrium, it can be made to vibrate with a single frequency, with its displacement from equilibrium described as a sine wave.  “Simple physical systems” of particular interest to musicians include strings on musical instrument, air inside wind instruments, or the vocal folds in the human throat – all these sources of musical sound can be made to vibrate in sinusoidal motion with a single frequency.
            b) When these sources vibrate sinusoidally, they create disturbances in the air (“sound waves”) that are best described by sine waves.
            c) Though sources of sound can vibrate with a single frequency, their motion is often more complicated.  However, that complicated motion can be described as the sum of several sine waves of different frequencies, all happening at once.  The sound waves produced can therefore also be described as the sum of several sine waves at once.
            d) For us, one important result is that a synthetic source of sound can imitate any sustained musical tone simply by putting together the right mix of sine waves. The pitch will be usually be determined by the strongest of the sine waves in the mix, and the timbre will be determined by the relative amount of other frequencies that are mixed together in that wave.  The black art of determining which sine waves to mix together to get a given tone is called  Fourier analysis.

It is this property of the sine wave -- that a complex waveform and timbre can be understood to be a combination of a number of discreet sine waves in harmonic relationship to one another -- that makes the understanding of sine waves to be base-line critical for a true understanding of making music with computers

The basic trigonometry of the unit circle

Recall that:

Pi ( π ) is the ratio of the circumference of a circle to its diameter: Pi ( π ) = C/D. It matters not how large or small the circle: this ratio is always the same. Divide a circumference of a circle by its diameter, and you 3.141596535...

It follows from algebraic equivalence then that C = π * D. (The circumference of a circle is equal to the diameter times pi). We get this by multiplying each side of the first equation by D, and the "D's" cancel out on the right side, leaving only the C. Thus C = pi • D.

Since the radius of a circle is half the diameter, it follows that the circumference is equal to 2πR, that is: 2 times the radius times pi (because D is two times the radius).

Since, in a unit circle, the radius is by definition equal to 1, then the circumference of a unit circle is simply 2 pi (2 pi times 1, or just 2π). .

One journey around a circle, 360º is the same as a journey of 2 pi. These are equivalent. A sine wave shows this excursion around a circle happening in time. A sine wave, ultimately, is a circle expressed in time.

Finding the sin of an angle within the unit circle.

You can find a wonderful animation of this concept here. You will need to have java installed on your computer to run this, but the site points you towards an installation of java.Your Adobe flash will probably also need to be up to date. Still, if you can do this, everything about the radians around the circle will be clear.

This lets you see how the right triangle is formed by the angle of the radius moving counterclockwise around the unit circle. Sine is opposite over hypotenuse, but since the hypotenuse in a unit circle is 1 - in this plot, that's the "height of the point as it moves around the circle." Then in this case sine is simply the length of the opposite side. This side varies in length as the angular displacement increases.

The length of the arc around the unit circle is expressed in radians. Radians can be found by taking the number of degrees of the angle and multiplying by pi/180.

Thus at 45º, the length of the sin is .707. At 90º the opposite side of the right triangle "disappears" and becomes equal to the length of the unit circle. Thus the sin of 90º is 1.

(At 45º, the length of the horizontal and vertical sides must be equal.  The Pythagorean theorem tells us that
            (horizontal)2 + (vertical)2 = (hypotenuse)2.
Here, the hypotenuse is 1, and the horizontal is equal to the vertical, so we find
             (vertical)2  + (vertical)2 = 12,
which tells us that the vertical side is 1/√2 =  .707. You might check on your calculator that sine of 45° [i.e., sin(45°) ] is equal to  0.707, and that 0.7072 = ½.
             At 90º the horizontal side of the right triangle "disappears", (shrinks to zero) so the vertical side becomes equal to the length of the radius of the unit circle. Thus the sine of 90º is 1.  (You might check that statement, too; does sin(90°) = 1? )

Study these diagrams, or better, play with the animation on the website, to better understand this.


The Trigonometry of Sine Waves and the Unit Circle

Understanding the relationship between the sine curve and the unit circle is a basic trigonometric concept which you need to understand for this class.

Open this patcher. You don't need to have a full install of Max to run this. You can open it in Max Runtime, which is a free application. You would have automatically installed this along with your demo version of Max. (Someone let me know if this runs in Windows. I've saved this as a stand-alone collective, rather than an actual Max patch, and sometimes that's platform dependent.)

We can glean from this patcher the essence of the sine wave equation:

y(t) = A \cdot \sin(2 \pi f t + \phi) = A \cdot \sin(\omega t + \phi)

Another way to write this, substituting the more familiar degree symbols for radians, is:


In this equation, “f” is the frequency in “cycles per second.”  Thus, f = 5 cps means the point goes around the circle 5 times every second.  The value f•t is then the number of cycles that elapse in time t.  For example, if f = 100 cps and t = 2 seconds, we’d know that f•t = 200 cycles: the wave would have gone through 200 cycles in those 2 seconds.

This leaves us with noticing that the 'w' above in the right hand formulation equals 2πf in the central formulation. (By the way, w is a Greek letter, pronounced “omega.”) We understand then that 'w' is the angular frequency, which is the rate of change of the function argument in radians per second. Thus the omega symbol is simply taken to mean the number of times around the circle in time 't'.

In the simulation, the value of “ “ is just the angle at which the unit radius starts (i.e., the angle at t=0).  In many applications of interest, we’ll start the radius at an angle of 0°, so will equal 0, and our equation will be .  For these purposes we can ignore the phase shift part, and we can also understand A to simply mean the size of the wave (i.e., its maximum displacement from zero), with 1 being its maximum in terms of the unit circle.

We see that a sine wave is a function that shows the position of the angular frequency of the wave at time 't', expressed in radians, and offset by a phase shift (if present).

For these purposes we can ignore the phase shift part, and we can also understand A to simply mean the size of the wave, with 1 being its maximum in terms of the unit circle.

The wave is plotted along the y axis for every unit of time time t, represented along the x axis.

Here is the max patch that generates a basic sine wavetable, and then allows you to move along that table at various speeds. It also directs you to the cycle~ object, which contains a cosine wave table similar to the one presented here, but sampled at 16,000 points, rather than the 626 points given in the demo.

Sine Wave Wavetable Demo

Again, this will open with Max Runtime.

Topics for this chapter

Assignments for this chapter

Musical Terms