Drums++ (Drum Beat Programming)Posted: August 2003 Introduction Drums++ is a programming language I designed for sequencing music through drum machines. It uses simple C ideas, for example // and /* */ comments and { } to seperate sections. I tried to make it as simple as possible so even a non-programmer could use it. See the docs section for more info on the language. Drums++ can both directly control your MIDI device or it can create .mid files which can be played through programs such as Microsoft Media Player. So you might wonder why I chose to do drum sequencing this way? Well, about 10 years ago I used to write drum sequences for my music using a program on my Amiga 500 called Dynamic Drums. Dynamic Drums is probably not a very powerful drum sequencing program, but it was so easy to use. I could write an entire song on that in about 10 minutes. The problem was the samples were very cheesy. So anyway, a few years ago my friend sold me his old Dr. Rhythm drum machine, which had much better sounds, but it was so hard to write a song. I tried downloading some MIDI programs for Linux, but they were too complicated for an idiot like me. So I decided to write my own MIDI sequencing program strictly for drums :). I figured a GUI would take me longer to write than a parser for a new programming language, so this is why I chose to make Drums++. Eventually I plan to write a GUI in either Java or GTK/C. Drums++ is based on the features of Dynamic Drums, the only difference is you don't click on a grid for where you want your beats, you type them in a text file. Eventually I might add new features to the language if they are requested. Some examples where I used it for my music:
Mandelbrot Cluster Downloads
drumsplusplus-0.96.tar.gz (source code, September 24, 2009) Samples Please note: Some of the .midi files here were made with old versions of Drums++ and may not work on all players. Newer versions of Drums++ make better .midi files
Syntax These commands will build a program called 'playdpp' which you will use to play your .dpp files or transform your .dpp files into MIDI files that can be played on any MIDI player. RunningRight now there are 3 command line options. If you type playdpp at the command prompt it will give you all it's options. Running playdpp will play your .dpp file to your MIDI sequencing device. Using the -o option, you can tell it to create a .midi file (which can be played through kmidi or Windows Media Player. The -i option will print on the screen which pattern/section is currently being outputed. An example would be: The playdpp program reads files with the .dpp extension. This program will read in your Drums++ files and either play them through your MIDI sequencer (aka. into your drum machine/midi keyboard) or create .midi/.mid files which you can play through your computer. I created a simple.dpp file so you can see how a complete file looks like. I also created a .midi file of this .dpp (using the newest feature of playdpp).. err at least I think they are the same. Anyway, if you want to hear it click here. It probably sounds a lot better coming out of a real drum machine tho. The first part of a .dpp file is the song settings. You must tell playdpp the beats per minute, default volume, drift (which I will explain later), and time signature. These must be set BEFORE the pattern sections that it affects. If you'd like a pattern to have different settings, you can redefine these before those sections.
All 'set' commands end with ';'. Note the use of C style comments. If you have // on a line, everything after that is ignored. Also, anything between /* and */ is ignored. So something like this is totally valid: set /* i'm a little teapot */ bpm = 230 ; The next section is optional, but recommended. This is the 'defines' section. Here you can set names for your drum samples. This will make your code easier to read. For example, on my Dr. Rhythm, the kick drum is sample 36 and the snare is sample 38. So I would add lines like this:
define kickdrum 36 This way in my pattern sections instead of writing: 36: 1 3; I could write instead: kickdrum: 1 3; Define lines do NOT have ; at the end. The next section is the patterns section. All pattern sections start with the word 'pattern' and then the name of the pattern. A pattern can be either a word or number, or combination of words and numbers starting with a word. For example: fill1 is valid, but 1fill is not. All patterns are written between { and } symbols. The text inbetween the { and } are written like this: <drum pad number>: <beats the drum is struck on>. So since I defined the snare drum as 38, if I want this pattern to play the snare on beats 2 and 4, I write it like this: snare: 2 4; If I wanted the kickdrum to be struck on beats 1, 1.5, and 3. I would add this: kickdrum: 1 1.5 3; If I wanted the volume of the kickdrum to louder than the default volume on beat 3, I can add a volume modifier (a : and a number between 0 and 255) like this: kickdrum: 1 1.5 3:200; Also, if I wanted the volume to be randomly different every time, I could put a % infront of the 200. This tells playdpp to pick a random number between 0 and what you set as the drift. Since I set the drift as 5, it will pick a random number between 0 and 5 and either add or subtract it from 200. It looks like this: kickdrum: 1 1.5 3:%200; Do not forget the ; at the end of each line. This lets the playdpp parser know when you are starting a new instrument. All together a pattern will look like this:
pattern test1 The sections take the same basic structure as the patterns do. After the word "section" you give it a section name, and then section data is placed between { and }. Section data consists of the word "play", the ':', and then the names of patterns you want to play separated by commas and ending in a semicolon. A section that plays fill2 twice and then pattern 1 once would look like this:
section b Finally, the song takes the same basic structure as section. The song name is optional. You may want to include it because when Drums++ is able to write out to .midi files, it will use this info. After the word play: you can tell Drums++ to play either single patterns separated by commas or sections separated by commas, or a combination. Here's an example of a song section:
song test_song Another useful feature of the Drums++ language is i the song and section parts, you can tell it to play a pattern or section a multiple number of times. For example:
song test_song This will tell Drums++ that within' the song "test_song", the pattern (or section) test will be played twice, then play section a, then b, then play pattern (or section) a twice. More Advanced Stuff At the start of each pattern section you are allowed to change some of the default settings such as bmp, time signature, and midi_channel. If you put a set at the top of the pattern, this setting will only be valid for this pattern. You can see an example of it in the channels.dpp example. You will also notice in this example a line that looks like this:
Copyright 1997-2025 - Michael Kohn
|