drumpatterns 0.55 guide


$Id: lidoma-guide.en.m4,v 1.9 2001/04/16 04:25:09 gilles Exp $

How to install and use drumpatterns 0.55

Documentation index

You can find the latest release of drumpatterns, by Gilles LAMIRAL, located at:

Courageous drummer scales

1. Introduction

This document describes the history and the use of a pattern generator for drummers called "DrumPatterns". For the moment, we will only focus on the member coordination (arms and feet). Independence and polyrythm will be taken into account later.

To introduce the subject, the best is to try the program available online from the DrumPatterns Home Page, with its default values. If you are already a drummer, the score will remind you something. Download the midi file and play it with a midi sequencer.

What DrumPatterns is useful for ? Practicing drum patterns.

This little program is a interesting demonstration of what can be done with Perl, CGI.pm and the HTTP protocol.

The software archive can be downloaded with ftp on the site linux-france.com.

I start with an analogy with the written language. We write texts which are made up of paragraphs. Paragraphs are made up of sentences, sentences are made up of words and words are made up of letters.

When someone wants to become a drummer, he has to work lots of exercises, stodgy at first sight, that help learning words, the vocabulary. The analogy is limited because the letters (the alphabet) are only a few. These letters are the strokes done by both hands and feet, right and left. The vocabulary is not predefined, it is "free".

The goal is to generate all the possible words (patterns) from an alphabet (right hand, left hand, right foot, left foot, silence) and some work rules (max consecutive tricks, patterns length), proved by experience.

2. Acknowledgments

I enumerate here the tools and their creator which helped me to build this little software and this documentation. I thank them all. I cite only the creators, the people that have collaborated are as deserving as them.

Thanks to Stan Mulder for the quality of his Steve Gadd site and the inspiration he gave me involuntarily.

I also thanks Julien Cassaigne who, by his mathematical knowledge, gave me a remarkable method to estimate the generated sequences number. It is not the one I used because it needs a formal calculator, heavy to run on a web server.

Many thanks to Nat Makarévitch who agreeded without hesitation the presence of DrumPatterns on his excellent French site linux-france.

3. Licenses

This software is protected by the GPL, the GNU Public License Version 2, in order to avoid to be ousted from it but I am really sceptic regarding any interest from a commercial compagny. The ugly drumpattern source code is in the bin/ directory.

I put this documentation under the opencontent license. This means this document is given without any warranty. You can use it, redistribute it, modify it, by respecting the following conditions: You have to clearly specify the nature and the content of the modifications, their date and keep the opencontent license in case of redistribution. If you sell it, you sell the medium, not the content. This is a summary, read the license to get more details.

4. Glossary


A hit.


A pattern, a combinaison, a word.

5. History

Originally, I was waiting for the announcement of a similar software on the excellent Steve gadd site. Steve Gadd is a red-hot and brilliant user of these basic scales. The site has been developed and it is still maintained by Stan Mulder. The url address is http://www.intrepidsoftware.com/sgadd/.

I have been waiting for several weeks but nothing came. So I wrote it myself. When I finally contacted Stan to give him my little program, he gave me the web address where was standing his. What a pity for me ! More, his program made more beautiful results than mine. I worked harder to offer a better interface and much more functionalities. Rivalry is beautiful !

This program has been sleeping for a time in one of my directories. Before putting it on line, I had to polish it because it can be very greedy for resources (CPU and especially the memory) and it can blow its running server brains out. I took good care to be sure that nobody could go beyond the interface and play with the server memory. I added a configuration file in order to allow the webmaster to adapt the beast according to the server availability.

6. Installation

The software drumpatterns runs only on Unix systems. Read the file INSTALL.

7. Using drumpatterns

First, I will describe the graphic interface globally, then I will detail each part.

7.1 General Interface

The interface presents in order :

7.2 The top 3 buttons

The first, called "Go !", runs the computation and presents the results if they respect the limits defined by the Web Master.

The second cancels the last interface manipulation and replaces the values with those that fit the submitted results; it does not run any computation.

The last runs the computation with the default values, as though you were loading the page for the first time.

7.3 The configuration table

It is a table composed with 5 lines and 4 columns. The lines represent the 5 members. The columns define the rules applied to each member.

The lines

Each line defines the member behavior rules set. The 5 members are the right hand, the left hand, the right foot, the left foot and the silence. I know the silence is not a member but fonctionnally speaking this corresponds.

The first column

It just numbers the lines. Nothing else to say.

The column `Seleted members'

This column is made of toggle buttons. The button defines whether the member takes part in the generated sequences. Take notice that it is necessary to toggle at least two member in this column to make relevant results because the one member sequences offer few interest.

The column `Max Consecutive tricks'

This column is made up with option menus, one per member. The chosen value (from 0 to 16) specifies the maximal number of consecutive strokes appearing in the sequences. It is useful to limit the exercises number.

Even if the toggle button that unselect the member is off, this value is useful. It is used to determine if an opposite sequence is good or not, regarding to this value. For example, if you choose the following parameters:

Right Hand selected,  Max Selected = 2, opposite = L
Left  Hand selected,  Max Selected = 2, opposite = R
Sequence length = 4

the sequence `RRLR' is not good in the normal loop `RRLR RRLR' but it is good in the opposite loop `RRLR LLRL'.

The column `Opposite Members'

This column is made up with option menus, one per member. The chosen value specifies the member to use to compose the opposite sequence. For example, if you choose left hand as the right hand opposite then the opposite sequence of `RLRR RLRR' is `RLRR LRLL'.

7.4 The sequences length

This option menu allows to define the sequences length. From 0 to 16. Nought is a value with no interest, it was included to check the program side effects, it has remained. Pay attention, beyond 5 the number of generated sequences can be very long to download. To estimate this time the table estimations can help you.

7.5 The presentation style

These are radio buttons. Choose the `character' mode or the `score' mode. The character mode is less greedy for place and is loaded faster than the score mode containing the images (You can compare the HTML source code in both case). But the score mode is very more readable. I thanks Stan Mulder for the trick (by an examination of his HTML) allowing to generate HTML scores with only 8 small images (look at the HTML source).

7.6 The estimations

The program is exhaustive, it looks for all the possible sequences. This can reach 152 587 890 625 combinations (5^16, five power sixteen) that is to say 124 Tera-octets of HTML page ! You certainly understand that I muzzled it to avoid overloading the server that put them up. Having said that, you can use this program yourself and jump the gate by editing the configuration file. The estimation table is made up of 4 lines and 17 columns :

7.7 Save your memory

One time you've chosen a configuration and you've run a sequence computation you can save the configuration by using this link. You have two possibilities :

  1. You follow this link to run again the same computation and you bookmark the resulting page.
  2. If you use Mozilla from Netscape or communicator or any advanced browser, you put your mouse on the link and you click on the right button. A contextual menu appears and you choose "Add Bookmark for link".

7.8 The sequences running time

It is the time that figures out how long it takes to compute the sequences, without any formatting neither a looping. You can notice that this time is always really shorter than the total time where are included the formatting and printing time. This part is really well traited.

7.9 The sequences number

This is computed sequences number, without any loop.

7.10 The sequence real length

The estimations about the length of the HTML pages are appraised by multiplying the line length by the number of lines. The line length can vary because some don't contain the marks <b> and </b> upon the sequence numbers. These are the sequences that do not respect the rules when they are looped with themselves or with their opposite and the numbers are not bolded. The estimate value is then always upper or equal to the real value.

7.11 The sequences

They are the pertinent data of the program. You can see for yourself that the generated sequences number is twice the announced number of sequences. More, each sequence has a length twice the one chosen in the configuration.

That's normal. In fact, each sequence has to be worked out in loop.

First with itself and then with its opposite, knowing that the opposite of a sequence is the sequence of the opposite strokes. The opposite strokes are defined in the fourth column of the configuration table, see details on section The column `Opposite Members'.

7.12 The complete running time

It's the total computation time, included looping, filtering, formatting, and printing.

8. Validity

If you find a bug, don't hesitate to inform me. In the same way for the spelling and the grammatical mistakes of this document (a lot to be done). If you find that the source code is horrible and dirtily written then we are both to think the same thing. I intend to transform the code towards the object oriented paradigm but I fear to loose in efficiency what I'll win in quality and maintenance (seeing the computer hardware progress, my fear is light).

The program has been developed on Linux, in Perl. I've tested it on Solaris 2 and it should run wherever Perl runs , that is to say everywhere, even on the dark side.

I've tested it with the following browsers : Lynx, Grail, Mosaic, Mozilla, TkWeb, RedBaron, Qweb, Amaya, Arena, W3. Let me know your results. Here are mine :

9. The `To Do'

Here is how I see the possible evolutions of the program. If you are interested , contact me, I can privilege the development of the part you prefer.


That's done.

Midi file generation is an excellent medium in order to work this exercices with a Midi engine, without reading anything, at different tempi. I found tclmidi. It is a very good tool. I won't make one.

Beautifull score

Nice scores in LaTeX, DVI, PostScript formats (A4, Letter, ...). Lilypond sounds very good.


Further variations. Accents are excellent to fix stroke control.


Here, more work in view, for me and for drummers. A code remodelling is needed. The opportunity to switch towards an object oriented architecture.

The blue java

A complete rewriting in an Java applet would be saving for the server's ressources. There is also Python (Is Grail still so low ?), and PerlTk (easier because in PerlTk there is Perl and Tk)