MelCom: A Text-to-Midi Melody Compiler

 

MelCom Language: Advanced Elements
Overview

Using MelCom

Download

The Language:
Starting Example
The Basics
Intermediate
Advanced
Examples

Contact

 

1. Reusable Definitions

The MelCom language provides means for defining and naming parts of the textually described music. Any defined part can then be reused just by referring to its name. This allows a more concise representation of pieces that have repeated parts. As a way of illustrating this feature, consider the following piece:

The part spanning measures 1 to 4 is repeated 3 times in the piece (measures 1 to 4, 5 to 8, and 13 to 16). This can be expressed in MelCom by defining and naming the repeated part, and then reusing it by just referring to its name. Following is how the piece is expressed in this way.

**n[A-B-C]
*t[60]

*def[basePhrase]
    16dd 16cc 16cc 16b 16b 16a-  |  16a- 16g 16f 8g 16a-  |
    8b 8g 16a- 16f  |  16e~ 32e~ 32d 16c 16d 8e~  |
*enddef

*usedef[basePhrase:2]

8b 8b 16b 16b  |  16cc 16b 16a# 16b 16a# 16b  |
16cc 16b 16a# 16b 16a# 16b  |  4cc 8g  |

*usedef[basePhrase]

16dd 16cc 16cc 16b 16b 16a-  |  16a- 16g 16f 8g 16a-  |
8b 8g 16a- 16f  |  8e~ 4:

In the above text, the music of the repeated part is enclosed between 2 lines:
*def[basePhrase]
and
*enddef
where "basePhrase" is the name we assigned to this definition.

Later, the line
*usedef[basePhrase:2]
signifies using -- in this place -- the defined part whose name is "basePhrase". The "2" after the colon (:) means that the defined part should be repeated twice here.

At the end of the piece, the line
*usedef[basePhrase]
means using -- in this place -- the defined part whose name is "basePhrase".

Following is another way of representing the same piece of music. This way expresses the musical structure more clearly by identifying the non-cadential and the cadential forms of the repeated phrase. It also demonstrates the possibility of using (expanding) a definition inside another definition.

**n[A-B-C]
*t[60]

!=== Start of Definitions ================================
*def[phraseFront]
    16dd 16cc 16cc 16b 16b 16a-  |  16a- 16g 16f 8g 16a-  |
    8b 8g 16a- 16f
*enddef

*def[phraseNormal]
    *usedef[phraseFront]
    16e~ 32e~ 32d 16c 16d 8e~
*enddef

*def[phraseCadance]
    *usedef[phraseFront]
    8e~
*enddef
!=== End of Definitions ==================================

*usedef[phraseNormal:2]

8b 8b 16b 16b  |  16cc 16b 16a# 16b 16a# 16b
16cc 16b 16a# 16b 16a# 16b  |  4cc 8g

*usedef[phraseNormal]
*usedef[phraseCadance]
 

2. Midi Meta Events

For the users who are familiar with Midi, the MelCom language provides means for including various Midi meta events. A line of the form:

!!$ <n>, <text>
where <n> is an integer between 1 and 7, and <text> is any text, will cause the resulting Midi file to have a meta event at this point in the piece of music. The integer <n> specifies the meta event type as follows:
1 : Text
2 : Copyright
3 : Sequence/track name
4 : Instrument name
5 : Lyric
6 : Marker
7 : Cue point

3. Auto Maqam-Changes

Mazzika and the Oud Tutor are programs that allow the user to use the computer keyboard to play a virtual piano or a virtual oud, with maqam control. These programs can also playback a Midi file, with animating the virtual instrument (piano or oud) to show how the piece of music can be played on a real instrument. Specially produced Midi files can also cause the virtual instrument to visually reflect the maqam being played, and to change the visual maqam dynamically -- if needed -- while the music is being played.

The MelCom language provides means for producing those Midi files that cause Mazzika and the Oud Tutor to change the visual maqam while the music is played. Immediately before the point where a visual maqam change is required, place a line of the form

!!$ 1, Q:<maqam name>/<n>
where:
<maqam name> is one of the maqams that are listed in the maqam drop-down list in either Mazzika or the Oud Tutor.
<n> is an integer representing the tonic of the maqam as follows:
0: C (Do)
1: C# or Db (Do diez or Re bemol)
2: D (Re)
3: D# or Eb (Re diez or Mi bemol)
4: E (Mi)
5: F (Fa)
6: F# or Gb (Fa diez or Sol bemol)
7: G (Sol)
8: G# or Ab (Sol diez or La bemol)
9: A (La)
10: A# or Bb (La diez or Si bemol)
11: B (Si)

For the cases where the tonic is half-flat (e.g., "Huzam" on E half-flat), just use the flat, and both programs (Mazzika and the Oud Tutor) will understand that half-flat is meant.