Home again, Home again, jiggedy jig
Listen to music created by Zel
Learn Zel
Download Zel
Send zel files or donate
Information about Zel
Listen to music created by Zel
Download Zel
Send zel files or donate
Information about Zel
Creating notes and setting pitch
The most common type of MIDI event is the note. A note is created by using the lowercase letters  a through g and the uppercase letters  A  through G. Lowercase c  is the lowest pitch of the range, and B  is the highest. Here are the pitches in order:
c d e f g a b C D E F G A B
This fragment produces an ascending scale in the key of C major (try it), but it is possible to play other major scales by qualifying notes with the " #"  symbol for sharpening and the " &"  symbol for flattening. These symbols create what musicians refer to as accidentals. Thus:
e f# g# a b C# D# E 
plays a scale of in E major. Once a note is sharpened or flattened, the effect is persistent until a barline ("|" )  symbol is encountered, another accidental associated with the same note is encountered or the key is changed. This is similar to standard music notation. To naturalize a note, qualify it with the " ^"  symbol. E.g.:

          C#  'C now defaults to C sharp
          C^  'C now defaults to C natural

You can also use multiple "#"   or "&"  symbols  to denote double and triple sharps and flats. For example:

is F double sharp (which in the world of MIDI is usually the same as G^). You can set the notes as sharp or flat automatically by using the key keyword to set the key signature. This keyword is easy to use--to set the key to a major key, use uppercase letters, for minor keys use lowercase. You can set the key at any point in a work. In the following example we change the key from A flat major to F sharp minor. Notice what happens to the pitch of the notes produced:
     key A&    A B C
f#    A B C
Which produces
     C 1      1:01:000 Note  68 A& 5 V 64 D  120 (null)
     C 1      1:02:000 Note  70
B& 5 V 64 D  120 (null)
     C 1      1:03:000 Note  60
C  5 V 64 D  120 (null)
     C 1      1:04:000 Note  69
A  5 V 64 D  120 (null)
     C 1      2:01:000 Note  71
B  5 V 64 D  120 (null)
     C 1      2:02:000 Note  61
C# 5 V 64 D  120 (null)
This example also illustrates the use of the list  keyword. When Zel encounters this keyword, it turns on the listing of events, so you can see what is happening.  We will often use parts of the list output to illustrate our examples. Each list entry tells you the MIDI channel, the time of the event, the MIDI pitch value, the musical pitch and octave, the velocity, the duration and the trackname the event is stored in. You can turn off listing by using the  nolist   keyword.

Learn Zel
Setting the Octave of a Note
The default octave is 5 for the note uppercase C, meaning that C will generate a note with MIDI pitch 60 (12 semitones per octave multiplied by 5), unless you tell Zel otherwise. The octave value can be set in various ways, one is by using the "@" parameter following the note. This will raise or lower the octave by one depending upon whether the note is an uppercase or lowercase. For example:                                        
will generate C at octave 6 (MIDI pitch 72), while
generates a C at octave 3 (MIDI pitch 36). Multiple "@"  signs will increase or decrease the octave value still further: For Example
will generate a note at octave 7.
To set the octave to other values, we use the " <
+-=>" convention used extensively throughout Zel. The "@" parameter can itself be followed by a numeric value, specified using the + - or = convention, where  "+" means raise, "-"  means lower and "="  means set. As an example consider:
This forces the octave of the C note to 4 (MIDI pitch 48). When the value following the "=" sign is positive, the "=" sign can be omitted, so "C@4" would have the same effect.  Using
lowers the pitch from the original C octave 5 to C octave 1 (MIDI note 12). Conversely:-
raises the pitch from C octave 5 to C octave 9 (MIDI note 108). The effect of the "@" note qualifier inside a chord is not persistent--subsequent notes will not be affected.
The default duration of a note
To understand how the duration of a note is specified, you must first understand the duration unit (DU). The DU  is determined by the current meter (set by the  metermeter  keyword).  For meters based on quarter notes (e.g standard 4/4 meter, or waltz 3/4 meter, or any meter ending with /4) the DU is one quarter note. For meters based on eighth notes such as 3/8, the DU is one eighth note, and so on. If no meter is specified, a default meter of 4/4 is assumed, so the DU is one quarter note. You can change the duration unit to any value by using the  duration  keyword described in the section on duration unitsduration_units . To calculate the number of clock ticks in a DU, you simply need to know the pulses per quarter note (ppq) value. This defaults to 120 but can be changed at the start of a work by using the ppq  keyword. The number of ticks in a DU is simply the number of quarter notes in a DU multiplied by the ppq value.
 Changing the duration of a note
The most common way to change the note duration from its default value is simply to follow the pitch by a number. For example, you could say:
to generate a note two duration units long. The more general method to set duration is to use fractions of the form
where n and m are both integers. So:
gives you a note 0.23  duration units long. There are shortcuts available with this method. Firstly, if the top part of the fraction (i.e. n) is 1, you can omit it:
generates a note of one seventh the duration unit. Secondly, whenever the bottom part of the fraction is 2 it can be omitted. So if both parts of the fraction are omitted, (both n and m) e.g.
is equivalent to writing
and creates a note one half a DU long. You can also specify the duration in terms of measures:beats:ticks e.g.:
in terms of SMPTE time--hours;minutes;seconds;frames e.g.:
 or in terms of decimal numbers, e.g.:
 Setting the velocity of a note
Each MIDI note carries with it a velocity value. For MIDI keyboards, the velocity of a note is related to how fast the key is pressed. Most synthesizers link velocity to the loudness of the note so that the higher the velocity, the louder the note produced. Some synthesizers enable velocity to be linked in other ways, but you will need to refer to your synthesizer manual for details.
In Zel, the default velocity of a note is 64 which is about half the maximum value of 127. If you don' t specify any velocities at all, you will find all the velocities will be set to 64. You can change the velocity of any note, using the "
!"   qualifier. Again we use the " +,-,="  convention, so
C!+2   C!-2   C!=2    C!25
would produce the notes:

C 1      1:01:000 Note  60 C  5 V 66 D  120 (null)
C 1      1:02:000 Note  60 C  5 V 62 D  120 (null)
C 1      1:03:000 Note  60 C  5 V  2 D  120 (null)
C 1      1:04:000 Note  60 C  5 V 25 D  120 (null)
Notice that if the " +" ," -"  or " ="  sign is omitted, the default is " =" .
Setting the MIDI channel of a note
 It is a good idea to make all the notes of a track the same voice of a MIDI instrument, that is to say the same MIDI channel. This avoids having to qualify each note with its MIDI channel. However, if you need to, Zel allows you to force a note into a particular MIDI channel by using the " $"  symbol. Again the " +,-,="  convention is used, so that:
C  C$2 C$+2
would produce:
C 1      1:01:000 Note  60 C  5 V 64 D  120 (null)
C 2      1:02:000 Note  60 C  5 V 64 D  120 (null)
C 3      1:03:000 Note  60 C  5 V 64 D  120 (null)