It was bring your kid to office day at TI and my daughter’s bday was coming up soon as well. I thought I should do something to spook a few kids with some magic. Given the choc-o-bloc schedule these days, I did not want to spend more time than 2-3 hours. Fortunately for me, my team at TI makes a secret ingredient for lots of magic – A 3D sensor.
I started with a OPT8241-CDK (Camera Development Kit). The kit provides a point cloud of 320 x 240 points. Point cloud is nothing but a collection of X, Y, Z and I (intensity) for each pixel in the camera. For example, this is what the point cloud of a lamp looks like –
After some thought, I decided to make a simple invisible musical instrument that even toddlers can appreciate (my daughter just turned 3). The 3D camera was to face up so that kids can move their hands over the camera to generate musical sounds. The distance of the hand from the camera would fix the amplitude and the lateral position of the hand would fix the note.
The code simply identifies the nearest blob in the scene and it’s 3D position. The ‘Z’ co-ordinate is used for the amplitude, The ‘X’ co-ordinate is digitized and used for the selecting the note. Since I decided to do everything in python, the midi-synthesis was just another line of import statement. All in all, as planned, I was able to complete the code under 2 hours. But the midi library was interesting and I ended up spending another 2 hours just playing with the various instruments available. Seriously, fluidsynth library is fun. The python code is hosted here. If you have an OPT8241-CDK with you and Voxel-SDK up on linux, all you need to do is run the python code.
The total number of notes to decode are quite small in number. All in all, there are just 12 notes and their octaves. Since the octaves sound similar, registering just 12 notes should be enough to decode all the music in the world. Compare this to some of the other things we remember –
Thousand of faces
Before the mobiles came around, hundreds of telephone numbers
Thousands of dialogues in movies
Characters in a language script, words and their meanings
Innumerable axioms, theorems, formulas
If we just look at the number of notes, compared to all of the above examples, learning music should be pretty straight forward! But, in practice, it seems much harder. Why???
Our ears are not perfect spectrum analyzers. They were not meant to be. Music is something that humans invented (please don’t quote examples of singing dolphins and whales, when I say music, I mean really complicated music). Nature made our ears capable of distinguishing various calls, voices etc. to help us survive. Having fun was probably a by-product of evaluation that came much later in time and much lower in priority. While identifying a frequency, our ears get confused very easily due to some other aspect of the sound being different. Listed below are some of these aspects (The list by no means is exhaustive) –
Volume of the sound
Sequence of notes played before (Like hysteresis in electronics)
The time the sound is played for (Like hold time in electronics)
The instruments (The timbre. This does not play much of a role in discerning the relative pitch within the same instrument. But plays a role when one has to listen to one instrument and recognize a another note played in some other instrument)
Volume of the sound
Try to identify if the notes are going up or down in frequency when I play the notes in the below clip.
The answers are –
If you got it right, you have one problem less to bother about.
Sequence of notes played before
Listen to the clip I play below and identify if the last note in sequence 1 is higher or lower in frequency than the last note played in sequence 2.
The answer might surprise most people. The two ending notes in both the sequences are actually the same!
Listen to the clip below. The two sequences have the same notes in the same order, but a novice may not recognize this similarity at all.
Error due to change in instrument is one of the less serious problems and most of you may pass the below test. Take a listen –
I have again played two sequences with exactly the same arrangement of notes. But the second sequence has a note of flute in it. Do they seem similar in frequency to you? If they do, you are doing good!
In the next class, we will deal with only two notes C and G and try to register them correctly irrespective volume, sequence and timing.
Musical notes are related to each other through ratios of frequencies. Our ears have a roughly logarithmic scale. Therefore, pairs of notes which have similar ratios, sound alike in arrangement. As an example, in the below clip, I am playing a C4 and F4# first and F4# and C5 later (first on a flute and then on a piano). The frequencies are 261.63 Hz (C4), 369.94 Hz (F4#) and 523.25 Hz (C5). Ratios are 1 : 1.414 (√2) in both the cases. Note that the type of the instrument hardly matters in discerning the arrangement.
Real instruments don’t produce pure tones, there are a lot of harmonics and each harmonic fades at a different rate. This set of characteristics of a particular instrument is called timbre. Timbre makes instruments sound different from one another although they ma be playing the same note.
Ears recognize tones with a frequency ratio of two to be in harmony with each other. For example, C4 (261.63 Hz) and C5 (523.25 Hz) are basically the same note but C5 has twice the frequency as C4. Therefore, a musical scale extends from one note to the next note that is twice the frequency. Within a scale, most modern musical traditions have a maximum of 12 notes.
Just Intonation vs Equal Temperament
Research has shown that for some not so completely understood reasons, we like notes that have a simple ratio of integers among themselves. The most basic example is that of the octave itself. That is, notes with a frequency ratio of two appear to be same note. The next smallest set of integers that can be used to form a ratio is 2 and 3. Infact, this happens to be the case with the notes C and G ( Sa and Pa in Indian notations). Therefore, C and G also happen to be the next most harmonious pair of notes. The Just Intonation temperament constructs all the notes within a scale using such simple ratios. More details here.
But, Just Intonation presents a practical problem. Singers don’t come with machine tuned voices. They would want to shift the reference scale as per their comfort and the mood of the song. If we want to shift the reference scale to another note other than C, then we have to re-tune all the notes around the new base note as per the ratio requirements. Imagine a pianist tuning all the strings every now and then to suit the singer. That would be disaster (although modern electronic instruments make this easy again). Musicians worked around this problem and approximated these ratios to the nearest numbers that formed a equal geometric progression. Such an arrangement is called Equal Temperament. For most people including several professional musicians, the difference between Just Intonation and Equal Temperament notes is not noticeable at all. Very few audiophiles and musical geniuses may be able to tell the difference between the two. More details here.Therefore, to make life easy, I will use Equal Temperament notes for all discussion from now on.
The 12 notes, the 7 major notes and scale shifting.
As mentioned previously, most modern musical traditions use a maximum of 12 notes within a scale. Some Arabic scales use 24 notes while there are other cultures which use only 5. Nevertheless, the fundamentals of learning music remain the same. Therefore, I will continue to use the 12 notes with 7 major notes as the reference through the rest of the series. It was also discussed that these 12 notes are in a geometric progression. Therefore, it follows that the frequency ratio between each note and the next is 1:21/12. Within these 12 notes, for reasons unknown (probably due to the obsession with number 7 and the cultural positive reinforcements over centuries), 7 of these notes happen to sound very natural and comforting when played consecutively. These are called the major notes in the west (Sargam in India). If we denote the step size from one note to the immediate neighbor as one, then the major notes can be represented as below –
On a piano, all the major notes are white keys. The minor keys are black keys. The same applies to Indian instruments such as the harmonium. We can now place the 5 minor notes between the major notes. These are just the missing positions in the above table. i.e 1, 3, 6, 8 and 10. The complete set is given below.
Now on, through this series, I will be referring to the western notation and the positions for ease of teaching. Positions are very useful in teaching relative arrangement of notes. If the difference in positions of two pairs of notes is the same, then the pairs sounds similar. Going back to the first example in this post, the position difference between C and F# is the same as F# and the next C. Therefore, the two pieces sounded similar. I recommend that people use a piano/electronic synthesizer vs any other instrument for the first lessons on music as these instruments reflect the math in the music in the simplest manner. To test the theory of relative positions, you can try the following experiment – Play the two sequences below on a piano and check if they sound similar –
Case 1 : C, D, E, F, G, A , B, C (Positions are 0, 2, 4, 5, 7, 9, 11, 12)
The two sequences played are the C and the C# scales. You can here me play it below –
Just for fun, you can try all the other 10 possibilities with different starting positions (D, D#, E and so on..) while keeping the relative positions between the successive notes same as the above examples.
Now that we have understood the theory, we can get started with the practicals. In the immediately following posts, I will elucidate the techniques for synthesizing and recognizing a small sub-set of notes which are the easiest to start with.
Flutes are probably the oldest of the man-made musical instruments. A cut bamboo might have served as the first resonating column and the wind, the first flautist that inspired a passerby nomad. My guess is that the first flutes probably looked like the pan flutes shown below –
I theorize that the idea of making multiple holes within the same bamboo and to cover/uncover holes to produce different notes requires some ingenuity and would have taken several centuries if not millenniums before we got a transverse flute that looks like the one below –
This kind of transverse flute was independently invented by the Europeans and the Indians. The association of flute with Krishna (Indian god and an Avatar of Vishnu) indicates that this instrument was already quite popular around 2000 BC. Given that Krishna was a cowherd and played “cool” folk tunes for Gopikas, Krishna’s flute was probably closer to the relatively short south Indian Venu or the smaller versions of Bansuri than the modern north Indian bass Bansuri. Infact, it took nearly 4000 years before the Indians reinvented the Bansuri. Pannalal Ghosh(1911-1960) was one of the first musicians to employ the Bansuri for serious Hindustani Classical Music. In the process, he experimented with the bore size, number of holes and the length of the flute to invent the bass Bansuri that I am going to describe in more detail in this article.
A typical Bansuri covers 2 octaves. Depending on the construction quality and the bore size, some notes of the 3rd octave can be played too. Smaller bore sizes allow reaching higher octaves. Why? Smaller bore size means lesser volume of air. To sustain the standing waves in the flute takes a lot of energy. And to sustain notes of the higher octave takes even more energy. Therefore, with lesser volume of air, the higher modes of vibration become more viable.
You can hear me playing a D4 flute below. The notes are D4 (fundamental), D5 (first harmonic, 2x) and A5 (second harmonic, 3x). I paid nearly 66$ for this flute and it is totally worth it.
What is this D4?? This is the lowest note that this Bansuri can play (technically, there is one more lower note, but this where the transposed C starts for this flute. In other words it is the scale of the flute). In Indian musical terminology, this would be Re. The fundamental frequency is 293.66Hz.
The Bansuri like all other flutes uses a resonating column of air to produce the various notes. The blowing end has a cork that blocks the energy from escaping from the blowing end. The other end is the first open hole. The fundamental mode of resonance has nodes on both the ends and just one antinode in between. Therefore the length of the column is half the wavelength. Here is an interesting puzzle.. If you actually measure the distance between the open ends, multiply this distance by 2 and name the value is λ, divide the speed of sound (c)by this λ, you would get a frequency that is higher than the note that you hear when you blow. Infact, when I tried this, I got an error of 10% !!!. Engineers like me would be jobless if simple mathematical models worked. Thank god, they don’t. The devil is always in the details. The actual phenomena is much more complicated than the simplistic theories of a both ends open pipe. For starters, the energy does not escape efficiently from only one hole. The next hole plays a part too. To test this, I tried closing the next hole and got a variation in the frequency. This proves that the simplistic assumption that only the closest open hole plays a role in deciding the frequency is wrong. Therefore, it means that the effective length of the column is actually more than the distance between the blowing hole and the first open hole. Experts who make flutes have to take this into account among several other such non-idealities. It is no surprise that a good concert Bansuri sometimes costs more than 10x that of a normal one.
To be cntd… The most important part – Playing the Bansuri
By usual standards, I started learning music quite late. I was already 20 when I first started toying around with a keyboard and a flute. Like me, I guess there are a lot of ppl who start out late either because the environment they were brought up in did not offer such avenues or simply because there were other priorities earlier in life.
Learning music does get harder with age. First of all, neural connections are more hardwired in an adult brain. Secondly, it is widely believed that unused connections are broken and the neurons are repurposed for other tasks.
With the limited time available for pursuing this hobby, I have experimented for 9 yrs now. I would have spent an average of 1-2hrs per week.I usually dont like to train under someone as I believe that the training will prejudice me. Also, ppl tend to teach adults in the same manner as kids. That hardly works.
After all these years, I have realized that if I had discovered the right techniques, I could have learnt as much in less than 1 year with the same effort. Unfortunately, I could not find such material online. Most sites start of with some instrument. Learn piano.. learn the flute… they teach you all the musical notations and so on…. But true music is hardly about the instrument or the notations. Its is about the ears and the brain.
Through this series, I am hoping that someone else will benefit. I am not trying to teach directly, as that would mean that I will end up prejudicing some one else. I am just trying to elucidate some techniques of learning. The actual learning is a process of self discovery that one has to walk on his/her own. Each person has his/her own style of learning and should stick to it for best results.