Documentation

A Bit of Music Theory

Before we delve into the language itself it is important to refer some basic concepts, namely, concepts that relate to the composition of rhythms.
If you are already familiar with these concepts feel free to skip this section.

The Note

The note is a distinct isolated sound that constitutes the basis of all music. each note has its own sound and duration.
In a drum music sheet the vertical position of a note relates to the instrument of that note, wether it is a hi hat, a snare drum or a bass drum.
Altough there are many standards the one we will consider is the Weinberg notation, indicated bellow.



Notice that not all these instruments are presented in the DrumLace language only the ones described in the table bellow (right above examples)

And the duration is signalled by the figure itself as presented in the image bellow.



A dotted note marks one and a half of the normal duration, for example a dotted quarter note marks 3 eighth notes.

The Meter

A meter is a recurring pattern of beats, usually indicating an accent by the musician, and marked by a vertical line.
A simple meter is defined as N/4, where N is the number of quarter notes in a meter. For example the most common time, 4/4 or c, consists on 4 quarter notes.
It is important to mention the divisions of notes as stated in the image above, so that a meter can be constitued by notes of different lengths as long as the sum is the same. Note that all the meters in the image bellow are valid.



Note that the eigths notes and the sixteenth notes when placed in a row are arranged as seen in the first four notes of the last meter. A compound rhythm is defined as N/8, where N is the number of eight notes. in a compound meter a beat is divided in three parts.

So, for example in a 6/8 meter the beat is marks 3 eighth notes and the meter contains two beats.

A mixed meter is defined as different meters followed by each other.

Tempo

Tempo is simply the speed of the music, the number of beats per minute.

Tupplets

Tupplets mark an irational division of a note,for example, the tripplet marks the divion of a note into 3 instead of 2.

DrumLace Syntax

Note that the language itself is still being developed so it is not advisable to use too many operators in a single sentence or to parallelize patterns with different sizes. Any bugs or programs that don't work as intended can be reported in the feedback page.

Drum Description

A drum description consists on the following syntax

Name_of_the_pattern={Time_signature;Tempo=Value_of_tempo;Instrument1 Instrument1_lines;Instrument2 Instrument2_lines;...;}

Instrument is the name of the instrument acording to the table of instruments.

An Instrument line is a series of note_length |X.X.| in which "X" marks a hit, "." marks a pause and "d" marks a dotted note. You can add how many instrument lines for each instrument.

Keep in mind that white spaces, tabs and newlines are irrelevant so just write in whatever way you like.

Take the example bellow that describes the famous boots and cats rhythm.

BootsandCats={4/4;Tempo = 180;
hh 1/8 |xxxx| 1/4 |xx|;
sn 1/4 |.X.X|;
bd 1/4 |X.X.|;}


Division of notes

To divide a note the syntax "note_length {notes}" can be used, thus allowing for the description of a tupplet.

Rhythm Algebra

After at least a pattern is defined new patterns can be defined according to some algebra rules



Concatenation/Sum

Final_pattern=Pattern_A+Pattern_B

Looping

Final_pattern=Pattern*number_of_iterations

Parallelization

Final_pattern=Pattern_A || Pattern_B

And you can combine all this operators to create patterns, for example

Final_pattern=(Pattern_A || Pattern_B)*2 + Pattern_C.

Functions

Besides using algebraic operators there is also the option of using functions according to the syntax
Final_pattern=Function(Pattern_A,...), different functions may require differnet arguments.
The list of currently avaiable functions is presented bellow

Function and arguments Description of the function
rev(Pattern) reverses the pattern, horizontal inversion
scale(Pattern,number) multiplies the tempo of the pattern by the given number

Export and DrumLace Program

The syntax of the export is simply export(Pattern_Name) A DrumLace Program should at least contain a Drum Description and an Export.

Instruments and how to call them

Instrument Name of intrument in DrumLace
bass drum/kick drum bd
snare drum sn
Hi Hat hh
Crash cymbal cymc
Floor Tom tomfl

Examples

Drum patterns

#this is a comment

Boots and Cats

BootsAndCats = {4/4;Tempo=220;
hh 1/8 |XXXXXXXX|;#hi hat
bd 1/4 |X.X.|;#bass drum
sn 1/4 |.X.X|;}#snare drum

Unnamed Rhythm

pat={4/4;Tempo=190;
hh 1/4 |XXX.XXX.X.X.|;
bd 1/2 |XXXXXX|;
sn 1/8 |..XX..X...XX..X...XX..X.XXX.X...|;
cymc 1/1 |...|1/8|..X....|1/8|X|;}#crash cymbal

3:4 polyrythm

poly={4/4;Tempo = 180;
sn 1/4 |XXXX|;
tomfl 1/1 |{XXX}|;}#floor tom

Brazillian Funk

bfunk={4/4;Tempo=110;
bd 1/8 |d...|1/16 |.| 1/8|X..|;
sn 1/16 |...| 1/8 |dX..X|;}


Amen break (Drum and Bass Rhythm)

amen={4/4;Tempo=120;
hh 1/8 |XXXXXXXX|;
bd 1/8 |XX...X|;
sn 1/8 |..X|1/16|.X.X..X..X|;}


Queen's we will rock you

Queen={4/4;Tempo = 80;
bd 1/8 |XX..XX..|;
sn 1/8 |..X...X.|;}

Full Programs

Example 1

funkintro={4/4;Tempo=110;
bd 1/8 |d...|1/16 |.| 1/8|X..|;
sn 1/16 |...| 1/8 |dX..X|;
cymc 1/1 |X|;}

funk={4/4;Tempo=110;
bd 1/8 |d...|1/16 |.| 1/8 |X..|;
sn 1/16 |...| 1/8 |dX..X|;}

funkr=funkintro+funk*3

hh={4/4;Tempo=110;
hh 1/8 |XXXXXXXX|;}
hha={4/4;Tempo=110;
hh 1/8 |XX|1/16|XXXX|1/8|XXXX|;}

cym={4/4;Tempo=110;cymc 1/1 |X|;}

res=funkr||(hh+hha)*2 + cym

export(res)

Example 2

funkintro={4/4;Tempo=110;
bd 1/8 |d...|1/16 |.| 1/8|X..|;
sn 1/16 |...| 1/8 |dX..X|;
cymc 1/1 |X|;}

funk={4/4;Tempo=110;
bd 1/8 |d...|1/16 |.| 1/8 |X..|;
sn 1/16 |...| 1/8 |dX..X|;}

funkr=funkintro+funk*3

plates={4/4;Tempo=110;
hh 1/8 |XXXXXXXX|;}

platesa={4/4;Tempo=110; #note that patterns cannot have numbers in their name
hh 1/8 |XX|1/16|XXXX|1/8|XXXX|;}

cym={4/4;Tempo=110;cymc 1/1 |X|;}

res=funkr||(plates+platesa)*2 + cym

export(res)