Software Details

How it works
The software is responsible for a few things:
a. Clearing the hardware's FIFO buffer.
b. Handling the user interface for the fret buttons.
c. Recording the events that might come at any time.
d. Playing the incoming events, and replaying back the recorded events if requested.

"Multiple Tracks" recording
The program has functionality to enable user to create a virtual music studio by recording different tracks. Here's how you would do it:

  1. Set up the fret buttons according to your need. Remember that you can select what kind of instruments you want to use, including the percussions. Click record button. Play! When you're done, click stop button.
  2. Setup another settings for fret buttons, or just leave it like that if you just want to add some arrangements on the music. Click play button. Click record button. Play your music using this settings. Click stop when you're done.
  3. Repeat # 2 as necessary
Now for each playback, you keep adding more and more sounds to the buffer. This will give you a notion of some tracks playing at the same time. Example: The one I did for the expo is like this:
First pass I played percussion "track" on it. Then second one I put some guitar arrangement on it. And the third one I put accoustic grand piano accompany on it. The playback wasn't bad at all except for the lousiness of Windows timer, some notes skipping could be noticed.

Unfortunately this capability was not shown very well during the expo due to number of people trying the guitar in real time only.

Note / Chord mode
To develop a full music arrangement, most of the times we need to do more than one instruments. And sometimes, we need to have chords instead of notes. Surely we can play a chord by playing several notes, but if we need more efficient way of playing chord we might just throw triplets and play them right away. The program handled this possibility. In fact, in Note / Chord mode, you can just drag and drop what kind of note, or possibily chord you want to associate with the fret buttons. And you can always change what kind of instruments you want to play it with.

Percussion mode
This mode implements MIDI standard 10th channel percussion playback. To change the instruments you want however, you must assign a note to it. You can click a button to show what note is associated with a percussion instrument to make your life easier.

Software Flowchart

The tricky part of this program is mostly because you must allow user to change the settings of the fret buttons on the fly. That's why I was designing the program to be multithreading. Besides polling on a single thread will freeze Windows OS due to the real tight loop used.

Event Data Structure
Name Type Explanation
mode int 0 = note, 1 = chord, 2 = percussion
tone DWORD value to send to MidiOutShortMsg() function
timestamp int time in ms starting from the "epoch". Epoch is reset each time recording started
chord_key array[0..2] of DWORD triplets DWORD values to send consecutively to midiOutShortMsg() function
instrument int what kind of instruments associated with this event

Screenshot from the program (click for full image)

Other stats
Compiler used Inprise Delphi 3.0
Languages used Pascal, C++, x86 Assembly
Code size (text) 48 kB
Compiled code 310 kB