Courageous drummer scales Gilles Lamiral v0.2, May 1998 _________________________________________________________________ This document describes the history, the working and the use of the 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. The DrumPatterns Home Page. _________________________________________________________________ 1. Introduction To introduce the subject, the best is to try the program Drum Patterns with its default values. If you are already a drummer, it will remind you something. For the others I'll try to explain its useful purpose. This little program constitute, I think, 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 paragraphes. 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 from an alphabet and some work rules, 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. * Linux (Linus Torvalds), for this beautiful jewel which made me buy a computer after 15 years of "I wait that technology stagnates". * Perl (Larry Wall), for having discharged me from ``core dump''. * CGI.pm (Lincoln Stein). * Apache, (The Apache Group). * SgmlTools (Cees de Groot). * Ispell (Geoff Kuenning). * Emacs (Richard M. Stallman). * Xpaint (David Koblas). * Mozilla (Netscape Communications Corporation). Thanks to Stan Mulder for the quality of his Steve Gadd site and the inspiration he gave me involuntarily. As well for 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. A great thank for Nat Makarévitch who agreeded without any hesitation the presence of DrumPatterns on his excellent French site linux-france. 3. License I put this software under the GPL, the GNU Public License Version 2, in order to avoid to be oust from it but I really doubt a commercial enterprise can be interested one day. The ugly DrumPattern source code is here. 4. Glossary Stroke A hit. Sequence A pattern, a combinaison, a word. 5. History Originally, I was longing to see the announcement of a similar software on the excellent Steve gadd site. Steve Gadd is a red-hot and brilliant user of those basic scales. The site has been built and it's still maintained by Stan Mulder. The name and the address are The Steve Gadd Site. I've been awaiting during several weeks but nothing came. Then, 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 return to work to offer a better interface and much more functionalities. Rivalry is beautiful ! It is a while since this program trails in one of my directory and that it is useful to no drummer but 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 care of checking that nobody will be able to go beyond the interface and play with the server memory. I added a configuration file in order to allow the web-master to adapt the beast according to the server availability. 6. Utilization First, I will describe the graphic interface globally, then I will detail each part. 6.1 General Interface The interface presents in order : * Three buttons. Details are on section The top 3 buttons. The first one runs the computation according to the input parameters, the second cancels the last changes and replaces them with the last ones, the third runs the computation with the default values (like the first time you went there). * The configuration table. Details are on section The configuration table which allows you to define the patterns construction rules. * The option menu that defines the generated sequences length. Details are on section The sequences length. * The radio buttons that allow to choose the output format, score or text. Details are on section The presentation style. * The table that presents the number of solutions and their kilo-octet rounded up HTML weight as a function of the sequence length. Details are on section The estimations. * A link to the same cgi page with the HTTP GET method to save the configuration in the bookmark. Details are on section Save your memory. * The running time of all sequences. Details are on section The sequence running time. * The number of sequences. Details are on section The sequences number. * The real weight of the sequences in Ko, once computation and filtering are done. Details are on section The sequence real lenght. * The patterns. Details are on section The sequences. * The whole computation time, filtering, formating and printing. Details are on section The complete running time. 6.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. 6.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''. 6.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. 6.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). 6.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 : * The first line gives the sequence length. It's the value you fill in the option menu called "Length". Take a look at the section sequences length * The second, the number of sequences. * The third, the length of the output in character mode (text). * The fourth, the length of the output in image mode (score). 6.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". 6.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. 6.9 The sequences number This is computed sequences number, without any loop. 6.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 and 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. 6.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''. 6.12 The complete running time It's the total computation time, included looping, filtering, formatting, and printing. 7. 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 : * Lynx is good. But it is difficult to read the estimations tables. It is the faster, as usual. * Grail does a very good presentation but suffer from an unbearable slowness while developing on a local server. * Mosaic : Table difficulties. * Mozilla : Good boy. You're the better, but not the fastest. * RedBaron : How about 16 bit color map ? * TkWeb : HTML is difficult, isn't it, TkWeb ? * Qweb : Poor boy ! It asks the server each image for each occurrence in the page... * Arena : Error while fetching http://louloutte.est.belle/sequencesHTML.cgi * Amaya : A little too young. * W3 (xemacs) : Same error than Qweb. 8. 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. Midi 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. Accents Further variations. Accents are excellent to fix stroke control. Polyrythms 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)