Thursday, October 25, 2012

Sa Re Ga Ma to MP3

It is hard learning music. I have a good memory for music I listen to but when I have a piece of paper in front of me in the Indian music notation, I am a bit lost. I don't see Sa Re Ga on paper and hear the tune in my head. Mainly because I am clueless when it comes to music written down. Oh, it is easy, just play it on an instrument you say? Well, I can't play an instrument either. I could hunt and peck my way on a keyboard but the results are not very useful. What if I can type in the notes from the piece of paper into a file and get a piece of music I can listen to over and over again till it is etched in my mind? How do I convert a piece of Indian music written as Sa Re Ga into an MP3?

Music Notation

Let us start with how Hindustani/Carnatic Music is normally written down. I am not comfortable with Devanagri but let me try. You have the seven basic notes written as follows.
सा रे ग म प ध नी सा
Oops, I screwed up - I told you I am not comfortable with Devanagri. It is as follows.
सा रे ग म प ध नि सा
A popular notation in use writes the same thing as follows.
S R G M P D N S
There are variations to handle the komal (flat) and thivr (sharp) notes but let me ignore them for the time being. To go to the same note in the next octave, the normal notation puts a dot above the note for the higher octave (Taar) and a dot below for the lower octave (Mandra). The above notation uses a quote mark(`) before the note for the lower octave and after the note for the higher octave. SO the above should be as follows.
S R G M P D N S'
This is a good start. A few more additions were needed to start with. A dash(-) after the note for an extended note. A tilde(~) after each of the two notes to indicate a glissando (meend). A vertical bar (|) for the rhythm cycle (Taal).
So now let us look at Raag Bhupali. Note that the below is what I was taught and have no idea why it is different to the wiki entry. The ascent (aroha) and descent (avaroha) are as follows.
Aroha: S R G P D S'
Avaroha: S' D P G R S
The Pakad is as follows.
S 'D | S R G | P G | D P G | R G R S
Note the use of the small pauses and the D from the lower octave.
The whole refrain (sthayi) and verse (antara) are as follows.
Sthayi:
P D S D P | G R S R | G- P G | D P G-
G P D S | R S D P | S S D P | G R S-
Antara:
G G P D | P S- S | D D S R | G R S-
G G G~ R~ S~ D~ | R R R~ S~ D~ P~ | S S S~ D~ P~ G~ | D D D~ P~ G~ R~
S~ R~ S~ R~ G G | R~ G~ R~ G~ P P | G~ P~ G~ P~ D D | P~ D~ P~ D~ S S

Note the use of the hyphen to extend a note and tildes for two successive notes to mimic a glissando.
Now we have the notation ready. Now to turn it into something I can listen to. Over and over again. Till it is stored in my memory.

Musical Notation to MP3

For generating notes, the favourite medium seems to be a midi file. My goto language is java. Which does not have a goto – isn't it ironic? I came across Kevin Boone's page for a java program that generates midi files in java. I used his MidiFile class and added one of my own, File2Midi.
The standard note period is set at a Quaver. An extended note is a Crotchet and a glissando is hacked by making the notes with a tilde a Semi Quaver. A vertical bar is a very short pause. Of the 128 instruments available, the one I thought would be the closest to what I wanted was a violin.
Now run it passing the text file containing the notes for the raag and you get a MIDI file. We are nearly there. Now run a MIDI to MP3 converter and you have the MP3 file. Now put it on an endless loop on my music device...

No comments:

Post a Comment