Virtual Drum Machine is a simple drum machine.
It works for little endian/linux kind of machines. You may let it work on others machines, but you probably will get troubles with it.
You definitely need oss (or maybe alsa) for sound output, and a posix-like operating system. To let it work on a big endian machine should be painful.
You write a rhythm, then you compile it, then you are able to play it to your sound card or save it to a file.
The Virtual Drum Machine is made of
* the Rhythm Compiler,
* the runtime library.
The Virtual Drum Machine is in the public domain. Who needs a license? money makers? Protection against robbery? let me laugh… Read any text of law, you will see where the robbers reside.
A simple file would look like :
tempo = 120;
* a c
Do a “./configure” in the drums directory, then “make”, then “make install”, it should be alright. You can listen to some examples in the examples/ directory.
Who yo use it?
Write a rhythm. Compile it with “rc”. Run the produced program. You are done.
See the examples/ directory to get the point.
When you run an example, try “-h” to get the available options.
It should be self-explanatory.
The rhythm compiler has several options. By running “rc –help”, all should be clear.
The compiler will parse the input file line by line.
If a line starts with “*” or “.” (not counting leading white spaces), the whole line is seen as a rhythm line, and is transformed into C code. If not, it is passed as is to the C file.
Beware! You MUST NOT start any C code line by “*” or “.”!
You can create as much functions as you want, write any C code you want. But remember that a line starting by “*” or “.” is seen as a rhythm line and is translated by “rc” into C code.
You must provide a “void main_rhythm(void)” function, that will be called by the library. It is the starting point of your rhythm. It can be “void main_rhythm(int argc, char *argv)” too, with common meaning for those parameters (non-C coders will have trouble with the Virtual Drum Machine).
You can change the tempo (ex. “tempo=100;”) or the volume (ex “vol=0.4;”) at any time. Each sample comes with its own volume and panning (ex. “a.vol = 0.1;” “a.pan=-0.8;”). Volumes range from 0 to what you want. 1 is for the normal volume. Panning ranges from -1 (left) to 1 (right). 0 is center. All values are double. You can use “volume” instead of “vol”, and “panning” instead of “pan”. There is no global panning, if you want all left, set all samples to left.
To run in stereo mode, don’t forget “-s” when running the generated program. It is mono by default.
You absolutely need to compile and run the examples, and read them to get the point out of it!
The “rc.conf” file contains configuration informations. You specify the sample by “sample” followed by its name (the one you will use in your rhythm files), then the file that will be played. The name of the sample must start by a letter, followed by letters and/or numbers (it must be a valid C identifier, without “_” though). The configuration file contains the install directory, used by “rc” to compile your rhythms. Take a look at the one that is provided to see how to use it.
The sound files are simple wav files. They all should be of the same rate, which can be specified to the generated program, using the “-f” option (44100 is the default). (The library only handles very basic wav files, if yours don’t work, you probably will have to modify the library for the program to handle it.)
When you add a sample, you must modify “rc.conf” for the changes to appear. The samples are hard-linked to the produced program, so if you change “sample a /some/dir/file1.wav” by “sample a /one/other/dir/file2.wav” in the configuration file, the previously generated programs will still use “/some/dir/file1.wav”. You will have to compile them again to take the changes into account.
Visit Sed Barbouky to download latest version.