A digital transformation

Transformation

Have you ever wondered how the music recorded by the Beatles, Pink Floyd or Led Zeppelin (or you for that matter!) is converted into its digital form? Just think of it: how do those carefree and chipper symphonies get converted into regimented bits of the digital world? The answer lies with the omnipotence of Mathematics;the wide applicability of the language of numbers provides tools to deal with something as complex as music. Music is complex because of its emotional aspect making it all the more difficult to be analyzed by a     scientific methodology. This improbable connection between Maths and Music really does seem astonishing. Melodies can be as varied as human temperaments and so the use of more advanced tools in Maths are required to study erratic patterns like that of music.

Such advanced tools were first developed from Joseph Fourier’s work that showed that representing functions as a sum of trigonometric functions greatly simplifies the study of heat transfer. This finding was further worked on to develop a powerful tool for studying complex functions. The method they used was in essence very similar to what Joseph Fourier had evolved and relied on the decomposition of complicated functions into simpler trigonometric sine functions. This method of “functional decomposition” is known today as Fourier decomposition(aka Fourier integral and Weierstrass transform).

When your friend plays his favorite piece of music on the guitar(or any other instrument he prefers), how does the recorder convert the musical notes into an audio clipping that is almost indistinguishable from the original tune he played? How are the physical rarefactions and compressions in the air converted into electrical signals?

The recorder performs Fourier decomposition!

noise.png

Your friend’s favorite piece of music(with slightly high asperity).

Screen Shot 2016-06-08 at 12.27.33 AM.png

Your friend’s music after Fourier decomposition.

Fourier decomposition relies on the fact that any wave that is periodic can be represented as the sum of sine waves.Examples of a few sinusoidal waves are given below:

sin(x)

graph of sin(x)

sin(2x)

graph of sin(2x), it has double the frequency.

 To completely represent a sine wave the following specifications are required:
  1. Direction
  2. Amplitude
  3. Frequency/Wavelength
  4. Phase Shift

The first three points seem pretty intuitive but what is the fourth point about?Consider the two graphs below:

sin(x)_phase

Graph of sin(x).

sin(x+1.5)phase

Graph of sin(x+1.5). Compare the two graphs at x = 0.

From the above graphs it is evident that shifting a graph to the right or left along the x-axis results in a phase shift. In the above case on adding 1.5, the graph of sin(x) shifts to the left by 1.5 units.

If you compare the graph of the music played by your friend(say graph A) and the graph of sin(x)(say graph B), it can be observed that though graph A is periodic, it has a much different waveform than graph B. It is obvious that graph A cannot be represented by only a single sine wave and so it requires the summing up of a variety of waves. The group of sines that most closely sums up to  graph A  are shown below:

1.34sin(x)

Graph of y= 1.34sin(x).

1.56sin(2x)

Graph of y = 1.56sin(2x).

-2sin(4x)

Graph of y = -2sin(4x).

If these three are added(try it on your graphing calculator!), the result is very close to the graph of the music played by your friend. But how would one find all these graphs? One way is to do it intuitively. However, that cannot achieve much specificity. It requires the  math formulae for Fourier decomposition. For math enthusiasts, below has been outlined the procedure that can used for accurately calculating the sines required to approximate a periodic complex function.

\textbf{f(x)} = \frac{\textbf{A}_\textbf{o}}2 + \sum \limits_{m=1}^\infty  \textbf{A}_m \textbf{cos}(\frac{2\pi mx}\lambda) + \sum \limits_{m=1}^\infty \textbf{B}_m \textbf{sin}(\frac{2\pi mx}\lambda)  

where f(x) is the complex periodic function we wish to decompose into a sum of sine waves.

This formula includes even the cosine function, while I had said that only sine functions are necessary to represent any periodic complex function. However, you will also notice that there is no term in the first equation to define the phase shift in the sine waves. This requirement of phase shift is met by the inclusion of the cosine function. If the cosine function had not been included, the above equation could have equivalently been written as:

\textbf{f(x)} = \frac{\textbf{A}_\textbf{o}}2 + \sum \limits_{m=1}^\infty \textbf{B}_m \textbf{sin}(\frac{2\pi mx}\lambda + \phi)   ,

where \phi defines the phase shift. But it turns out that it is more convenient to deal with the first form rather than the second form of the equation.

Now considering each term in the equation one at a time. The term \frac{\textbf{A}_0}2 serves to define a sine wave with infinite wavelength. Suppose that we had to approximate the complex function with only one sine wave, which sine wave would be the best? It would be precisely this sine wave with a value of  \frac{\textbf{A}_0}2 . It is basically the average of the function values in each period. Consider the following example:funnyfn

The average value function for the above function would look something like this :

Avg

Next considering the summation of the sine waves:

\sum \limits_{m=1}^\infty \textbf{B}_m \textbf{sin}(\frac{2\pi mx}\lambda)   .

The question arises as to why the summation upper limit is \infty ? Well, the answer is simple: it is to increase the accuracy of the approximation. The greater the number of terms we add , the better will be our approximation of the complex function f(x)(it improves something that is called resolution). Next, \textbf{B}_m   is the amplitude of the sine wave as defined by the formula :

\textbf{B}_m = \frac{2}m  \int \limits_{0}^\lambda \text{f(x)} \textbf{sin}(\frac{2\pi mx}\lambda) \text{ }  dx  .

It can be interpreted as a weight that indicates how much of a particular sine wave is present in the complex function f(x).

Each part of the summation of the cosine functions has a similar role. The formula for \textbf{A}_m is :

\textbf{A}_m = \frac{2}m  \int \limits_{0}^\lambda \textbf{f(x)} \textbf{cos}(\frac{2\pi mx}\lambda)  \text{ } dx  .

If you are inclined enough to perform these operations, you can functionally decompose many complex functions into a sums of sine and cosine waves. However, they do exist plenty of monstrous functions that don’t give way to their secrets so easily and it requires more effort(plenty of scary maths and so they will not be discussed here) to capture such beasts.

The outcome of this process of Fourier transformation: you are enabled to record your friend’s music and listen to it in moments of nostalgia, reminiscence, reflection,…etc.Also on a more practical tone, the process of Fourier transformation helps to save a lot of digital storage space  since it helps to convert a complex piece of music into smaller trigonometric functions that can be easily stored by a computer. This is the essence of the technology behind MP3. Actually, the application of Fourier transforms is much more ubiquitous and it is used in solutions to many problems in fields ranging from optics to X-ray crystallography(Cricks and Watson used it to decode the double helix structure of the DNA), voice recognition programs(Siri!) and MRI scans.You could even start a lucrative business out of selling your friend’s music to teenagers all around the world!

6 thoughts on “A digital transformation

Leave a comment