LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need a MIDI Input function in LabVIEW. I have found all kinds of examples of MIDI out, but not in.

All over the internet, there are examples of outputting a MIDI sound using the Windows MM DLL.  Surely someone has done the opposite, created a way to INPUT a MIDI sound. 
0 Kudos
Message 1 of 6
(4,218 Views)
When you say you want to input a MIDI sound, do you mean that you want to build a MIDI file, you want to have a microphone listen to a sound generated by a MIDI file through a player or you want to build a MIDI file player?

Let us know.  It can make a lot of difference in the answer Smiley Very Happy

Bob Young


0 Kudos
Message 2 of 6
(4,212 Views)
Basically, I have a MIDI keyboard that has a USB interface.  The keyboard doesn't have speakers or anything, but does plug in and Windows will recognize it as a MIDI device.  You press a key on the keyboard and windows will play the note.  I want to at the simplest level, be able to press a note and have LabVIEW display the waveform in addition to possibly playing it.  This is for an exhibit at a children's science museum. 

The examples out there for MIDI output all use the windows mmedia.dll.   I don't see why MIDI input would be any different, but the dll isn't straightforward.  One thing I have found is that you can have the windows multi-media dll fire an event.  So, I'm looking into how you could have a LV application waiting for a windows MIDI event.  This is not straightforward either. 
0 Kudos
Message 3 of 6
(4,198 Views)
When you say a USB MIDI keyboard, do you mean some similar to the M-Audio products?  

If so, I'm sure my computer required the driver before Windows recognized the device.  With my M-Audio keyboard, all the actual sounds are provided by the Reason software and are not resident on the keyboard itself in any fashion.  (Yours may be different)  

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 4 of 6
(4,130 Views)
The MIDI data stream is very compact, entirely digital, and does not contain any waveform information as such, merely a description of what , (an instrument type,  for example) how loud, and when a particular note is played. Your computer does all the rest, either in hardware such as a sound card, or in a software application. Your LV would need to access the generated waveform data from one of these sources.
0 Kudos
Message 5 of 6
(4,124 Views)

You are misunderstanding Jamie's request. The scoop here is how to capture incoming MIDI messages and, based on their contents, perform a given task. Jamie wants to have his VI display the graphics of a waveform associated with a specific Note On message. However, if he would prefer doing so, he could choose to display a hippo or a picture of his mum on the event of receiving a given Note On message, say C4. I myself is trying to decode the MIDI stream and based upon what Note On/Off I get, turn a lamp on/off. That is, I am building a MIDI controlled lighting mixer.

The procedure to get MIDI in is already included in the WIN32 API and well described here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_midiinopen.asp

There is additional info by Jeff Glatt here. It gives som good examples for incorporating the required calls from C:

http://www.borg.com/~jglatt/tech/lowmidi.htm

Unfortunately, the story of the midiInOpen function seems to end with the difficuties of having LV receiving CALLBACKS from a previously called dll. A callback just happens to be exactly what the midiInOpen function is doing to pass incoming MIDI back to the caller (LV). So, anyone confident enough, PLEASE study the link(s) above and help create a VI that manages the call/callback needed to have MIDI data flowing into LV!
 
/Stefan
0 Kudos
Message 6 of 6
(4,113 Views)