I am developing a VB.net application that should read the value of a MIDI note from an external pad that sends values on channel 10. This value will be used to control various aspects of my application.
I plan to use the MIDI-dot-net class found here: https://code.google.com/p/midi-dot-net/ to read the value of the note and looked at one example that reads a note played by an external keyboard, and displays them.
Unfortunately, I cannot convert this to do what I want, although I think I'm pretty close.
Are there any users who are familiar with this library and can identify my errors? C # is not my main language (in fact, VB.net is not either!), But if I can get something working in C #, then I can convert it to VB.net for use in my application.
Alternatively, is there another way to do what I want?
Here is my code:
using System; using Midi; using System.Threading; using System.Collections.Generic; namespace MidiExamples { public class Example05 : ExampleBase { public Example05() : base("Example05.cs", "Prints notes and chords as they are played.") { } public class Summarizer { public Summarizer(InputDevice inputDevice) { this.inputDevice = inputDevice; percussionPressed = new Dictionary<Percussion, string>(); inputDevice.NoteOn += new InputDevice.NoteOnHandler(this.NoteOn); inputDevice.NoteOff += new InputDevice.NoteOffHandler(this.NoteOff); } private void PrintStatus() { Console.Clear(); Console.WriteLine("Play notes and chords on the MIDI input device, and watch"); Console.WriteLine("their names printed here. Press any QUERTY key to quit."); Console.WriteLine();
In particular, I'm not sure how to determine the behavior of NoteOn and NoteOff ...
Thank you in advance
Phil
source share