MIDI DEMO

This Demo shows how to trigger MIDI-Note ON/OF.

1. You must have a soundcard supporting midi installed in your machine and must be configured correctly. The midi device must be "/dev/midi". If it is currently "/dev/midi0" make a symlink (as root).
> cd /dev ln -s midi0 midi
2. Connect a midi-device e.g. a synthesizer to the soundcard. The midi-device should be configured that on channel 1 note 60 makes some noise.
3. Make sure the mtx.portmap daemon is running
4. Start the console device in one xterm on your machine
> /usr/local/martix/bin/devconsole
5. Start the midi device in another xterm on you machine
> /usr/local/matrix/bin/devmidi
6. Start the testmidi script in a third xterm
> /usr/local/matrix/bin/testmidi
7. Move the mouse to the xterm where the devconsole is running
8. Press the key "N" (for NoteOn) A should here a tone now.
9. Press the key "n" (for NoteOff) silence.....
10. Look at the testmidi script and find out how it works.

source code

#!/usr/local/matrix/bin/matrix

-> con:read('N')
{
        con:writeln("NoteOn on channel 1, note 60, velocity 127");
        midi:NoteOn(0, 60, 127);
}

-> con:read('n')
{
        con:writeln("NoteOff on channel 1, note 60, velocity 127");
        midi:NoteOff(0, 60, 127);
}

-> con:read('e')
{
        exit(0);
}

download midi demo here