Using different MIDI event types with the WiiMote Theremin

by Stephen Hobley on December 9, 2009

I recently was asked if it were possible to output continuous controller data from the WiiMote Theremin device I created here

This should be pretty simple as the Toub.Sound.Midi library supports CC data just like the Note On/Off.

If you open up the source code in Visual Studio Express C# – you should be able to find the line in the Form.cs file that plays the notes…

This can be easily changed to support CC data as follows:

// Removed, since we are no longer sending MIDI Notes,
// just CC we do not need to send a note off
//if (LastNoteNo != 255)
//    NoteOff();
// ----------------------------------
// Convert the raw val to a MIDI note by dividing by 10
LastNoteNo = temp;
// This is the line that takes the camera X coordinate value and outputs it as a MIDI note
// start to output CC data instead
//Toub.Sound.Midi.NoteOn _n = new NoteOn(0, 0x0, LastNoteNo, 100);
//Toub.Sound.Midi.MidiPlayer.Play(_n);
// Set this to 0-15 for the 16 MIDI channels
byte MIDIOutChannel = 0;
// Set this to your desired controller number
byte ccNumber = 33;
Toub.Sound.Midi.Controller _cc = new Controller(0, MIDIOutChannel, ccNumber, LastNoteNo);
Toub.Sound.Midi.MidiPlayer.Play(_cc);
Share

Leave a Comment

Comments links could be nofollow free.

Previous post:

Next post: