Midi piano for VB.net
-
I'm looking for a midi piano class that is written in vb.net. I have found plenty in VB6 and C, but not written in Vb.net. The class should be able to play notes that I can call from the form with parameters for note (e.g. "C" in octave 4) and for duration (millisecons). The grand piano sound of General MIDI is enough. Here are two examples. Can someone translate one of them in VB.net? I would be most grateful! http://www.xtremevbtalk.com/showthread.php?t=36582& (scroll few posts down) http://www.a1vbcode.com/app-2951.asp (download link)
-
I'm looking for a midi piano class that is written in vb.net. I have found plenty in VB6 and C, but not written in Vb.net. The class should be able to play notes that I can call from the form with parameters for note (e.g. "C" in octave 4) and for duration (millisecons). The grand piano sound of General MIDI is enough. Here are two examples. Can someone translate one of them in VB.net? I would be most grateful! http://www.xtremevbtalk.com/showthread.php?t=36582& (scroll few posts down) http://www.a1vbcode.com/app-2951.asp (download link)
-
You can modify this vb.net code into a class, Take a look here: http://www.tomgroves.net/projects/vbmidi/[^] Notes: 'Grand Piano Midi Patch Number is 0 'Octave 4 "C" Pitch (Midi Note Number) 108, Freq = 4,186.0090448096 Hz Progload
Hey, thanks a lot! :) I'll try that tomorrow. By the way, is it possible to play two notes at the same time?
-
Hey, thanks a lot! :) I'll try that tomorrow. By the way, is it possible to play two notes at the same time?
-
re infecta wrote:
is it possible to play two notes at the same time
In Sequence, Yes, just send the new message right after the first message.(just don't forget to close all the messages when your done with them.) Progoad
OK! The code worked very well. One question still: How to open two midi channels and play them at the same time: one playing grandpiano and the other playing percussion (drum hit)?
-
OK! The code worked very well. One question still: How to open two midi channels and play them at the same time: one playing grandpiano and the other playing percussion (drum hit)?
'Send a program change message. Change the last zero to any other number < 16 'to specify which channel to alter. Change '70' to any number between 0 and 127 'to set which patch to assign. '
'sm(&HC0 + (70 \* &H100) + 0) ' ^ ^ ' | | ' | +---------- Midi Channel Number (0 to 16) ' | ' +----------------------- Midi Patch Number (0 to 127)
sm(&HC0 + (118 * &H100) + 1) ' <<== Change Patch to 118 "GM Synth Drum" on channel 1" Or change Midi Channel to 9 (all notes in GM on channel 9 are different percussion instruments) Here is a "Patch Map" for GM Patches(subtract 1 in your code) and GM Drums( channel 9). http://jedi.ks.uiuc.edu/~johns/links/music/gm.htm[^] Example: sm(&HC0 + (0 * &H100) + 0) <== Change Patch on Channel 0 to "Grand Piano" sm(&HC0 + (118 * &H100) + 1) <== Change Patch on Channel 1 to "GM Synth Drum" sm(&H90 + ((60) * &H100) + (80 * &H10000) + 0) <== Octave 0 Middle "C" "Grand Piano" on Channel 0 sm(&H90 + ((62) * &H100) + (80 * &H10000) + 1) <== Octave 0 Middle "D" "GM Synth Drum" on Channel 1 sm(&H90 + ((38) * &H100) + (80 * &H10000) + 9) <== GM Drum kit "Acoustic Snare" Channel 9 Would play "C" (Pitch on Piano), "D"(Pitch on Synth Drum), And the Acoustic Snare. Progload -- modified at 15:50 Thursday 5th October, 2006