Before diving into the world of audio in the digital domain, we need to understand the
fundamentals of audio.
And the simplest way to talk about a subject is to figure out the elemental part that makes
up the subject.
For a lot of areas of study this is hard to do, since the makeup is ambiguous and fairly
hard to single out.
But in the world of audio, it is unmistakably simple.
Simple harmonic motion.
The physics behind sound and the generation of simple harmonic motion is described in
another module on Acoustics, but let's talk instead about the mathematics behind simple
harmonic motion, and more specifically, a sine wave.
We’ve all seen a sine wave before.
The squiggly wavy shape that you see in music equalizers brings a certain clarity to the
context.
A Sine wave is the purest form of audio, which represents an exact frequency or a tonal value.
Infact sine waves don’t exist in isolation in nature.
No natural source of sound generates a singular sine wave, but rather a multitude of sine
waves bundled and added together.
More surprisingly, it is possible to recreate any sound, including my own voice, by just
adding different sine waves together.
Although this can get expensive and absurdly complicated and there are different synthesis
methods to recreate sounds which you will be learning about later on.
Sine waves can truly be thought of as the building blocks of audio, like a piece of
Lego.
Since sine waves are quite essential to the study of audio and since Digital systems can
produce single sine waves, and with ease, we need to get a good grasp of where the sine
wave originates from.
And we go back to the humble beginnings of the triangle.
And more specifically, the right angled triangle.
We choose the right angled triangle here, since it has a few established properties
that we can use and leverage.
So what do we know about the right triangle, apart from the fact that one of its sides
is at a 90 degree angle with the other.
So we know that, since the sum of all angles of a triangle is 180 deg, the sum of the 2
other angles of the triangle has to be 90 deg.
Here angle a + angle b = 90 degrees We also know that the pythagorean theorem
is established for right triangles, where it states that the sum of the squares of the
sides of a triangle is equal to the square of the hypotenuse.
Written out, it’s simply x2 + y2 = hyp2.
Let's put a pin on this, we will use it later.
What else do we know?
We know that there are certain well defined, but arbitrary ratios that are conjured up
for right angled triangles.
These ratios provide relationships between the sides and angles of a right angle triangle,
and these are called trigonometric ratios or functions.
There are 6 in all, but 3 of them are commonly used.
That's the sine of an angle a, which is the ratio of the opposite side to the hypotenuse.
The cosine function, which is the ratio of the adjacent side to the hypotenuse.
And then we have the tangent function which is the ratio of the opposite side to the adjacent
side.
You might have noticed that a sine function is already described here.
The end goal of this module is to describe the sine function, but it’s not yet in a
form that is recognizable or consumable for audio purposes.
So let's push on.
You might wonder at this point of time what the purpose of these trigonometric ratios
are.
They are just made up fractions afterall, that describe some relationships.
However there are several practical applications to these ratios.
Let's take a simple example.
Let's say you want to calculate the height of a building or a tree.
One way you could possibly do it is to take a tape measure, climb the tree and measure
how tall it is.
A less daft of a person would try to use the power of observational mathematics to do the
same.
What do we know about the environment?
We can position ourselves at a point P in the world.
And we can look up at the tree and measure the angle at which we need to tilt in order
to observe the tree from our position on the ground.
Let’s call this angle theta.
We can also walk over to the tree and measure the distance of the tree from our initial
position P. What we have here is a rudimentary right angled triangle, where we have determined
one of the angles, and the length of its adjacent side.
The information we are lacking is length of the hypotenuse, which is quite hard to determine
in our case using conventional means, and the length of the opposite side, or the height
of the tree, the answer to which we are looking for.
All we need to do is leverage one of the trigonometric functions and substitute the values.
The tangent function comes into mind.
Tan of the angle theta is equal to the opposite side over the adjacent side.
Let's put a couple of concrete values here, say the distance to the tree is 60m and the
angle we are observing it is 60 degrees.
If we rearrange the equation we can easily find the height of the tree if only we knew
the tan of the angle of 60 degrees.
Fortunately, I seem to possess the values of the tan function for a few key angles and
they’re tabulated here.
That’s handy!
Tan of 60 degrees is the root of 3.
And root of 3 multiplied by 60 is approximately 104m.
That’s a tall tree.
It was quite convenient that we had the tan conversion table.
But how did we arrive at those values?
Tan of theta is said to be a continuous function over the angle theta.
A function in mathematics, or in programming for that matter, is a relation where you can
plug in or substitute any value for the parameter that it operates over, and you get an output
in each case.
Let’s try to find the values of the sine function.
For this, we need to simplify the triangle further.
Any unknowns we can eliminate, the better.
To do this we turn to circles.
Unit circles.