LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MIDI IN

Dear LabViewers!
I am stunned (and more importantly frustrated) over the fact that no one has, to my knowledge,
ever come up with a solution to get MIDI signals into LV! Surely, there must be more than 3 or 4
of us interested in the matter. So...a hero and the object for my lifelong adoration is the one who
presents me with a working solution! 😃 Obviously, I admit, I have failed in doing so myself.
 
/Stefan
0 Kudos
Message 1 of 23
(11,491 Views)
I had a look around as I'm a little interested in this as well.

There's a midi example library here:

http://sine.ni.com/apps/utf8/niepd_web_display.display_epd4?p_guid=B123AE0CBBD8111EE034080020E74861

And there's a USB port sniffer here:

http://sourceforge.net/project/showfiles.php?group_id=34567

I've got one of those little M-Audio 25 Key midi controllers.  It would be interesting to see if Labview could recognize it as input. 

Good luck.

Message Edited by pallen on 05-24-2006 10:37 AM

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 2 of 23
(11,461 Views)

The MIDI example library is using the right features of the WIN32 API. Sadly, there are only examples MIDI OUT included. I guess whoever wrote it was also aware of that getting MIDI in is a bit more complex since it requires the use of callbacks.

The USB sniffer could probably "wedge" into the stream and see data passing by, but this would only be true for a USB connected device such as yours, the M-Audio 25. MIDI however, can be received via any Windows registered interface such as a Gameport or a serial or parallel port connected MIDI interface. All of these are available using the API functionalities (you pass the dll a DeviceID associated with the specific MIDI in enabled device. To see if you have any MIDI in devices in your system you could try the API's midiInGetNumDevs which I included in the attached VI!)

/Stefan

0 Kudos
Message 3 of 23
(11,448 Views)

Hello!

It is true that the examples that can be found on our website are MIDI Out only and that neither of them is set up to input MIDI data. However it should hopefully be not too hard to modify the code so you can acquire data instead. The examples you have found calls a shared library called winmm.dll which then outputs the MIDI data by calling functions such as MidiOutOpen and MidiOutStart. This DLL also contains functions like MidiInOpen and MidiInStart which you should be able to use in order to capture MIDI data.

You can find information about calling these functions correctly from www.msdn.com, the Microsoft Developer Network. More specifically, you can refer to the following link for more information on these functions:

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

 

The toolbar on the left of the page above also contains links to the other MidiIn functions you might call.

 

There is no prebuilt example to do all this, but you can use the information above together with the output examples to build a VI which will accomplish what you want. For more information on calling DLL’s in LabVIEW using the Call Library Function Node, refer to the following links:

 

An Overview of Accessing DLLs or Shared Libraries from LabVIEW

http://zone.ni.com/devzone/conceptd.nsf/webmain/b26a875aca51c567862567ca0055ff24

 

Calling the Win32 SDK

http://zone.ni.com/devzone/conceptd.nsf/webmain/6ed4643f866a68f4862567ca007886d1

Regards,
Jimmie Adolph
Systems Engineering Manager, National Instruments Northern European Region

0 Kudos
Message 4 of 23
(11,435 Views)

Jimmie!

Thanks for your reply. I agree, there is good info to be found at MSDN and in the links you provided. Still, if you were to look into the description regarding calling MidiInOpen you will discover that it is returning incoming MIDI data by triggering a CALLBACK that is to be defined in the 3rd argument of the MidiInOpen-call. As far as I have learned, this callback cannot be recognized as a UserEvent by LV, hence LV is unable to capture MIDI in data from the API. What one needs to do is to create a wrapper dll that handles the API interfacing and then, upon receiving data, creates a LV UserEvent. Sadly, I am not the one to solve it because I don't do C. Anyone...HELP?! 😃

Here is some C code that does the actual API stuff. If it could be modified to also incorporate a PostLVUserEvent (right?) it would do the trick. http://www.borg.com/~jglatt/midi/software/dev/winapi/midiin.zip

/Vedeja

Message Edited by Vedeja on 05-29-2006 11:29 AM

0 Kudos
Message 5 of 23
(11,432 Views)

Hello!

Here is some information about callbacks in DLLs and LabVIEW:

DLL CALLBACK EVENT IN LABVIEW  
http://forums.ni.com/ni/board/message?board.id=170&message.id=99096&requireLogin=False

Callback from DLL file, back to Labview 6.1 event, How?
http://forums.ni.com/ni/board/message?board.id=170&message.id=24796&view=by_date_ascending&page=1

Howto pass a callback function to call library function node
http://forums.ni.com/ni/board/message?board.id=170&message.id=88974&view=by_date_ascending&page=1

They contain information that might be useful!

Regards,
Jimmie Adolph
Systems Engineering Manager, National Instruments Northern European Region

0 Kudos
Message 6 of 23
(11,416 Views)
Hello Vedeja,

I read your initial plea with great interest. I too have been working on a LV program that requires obtaining MIDI input data and passing it through to the Windows MIDI output. Your analysis of the situation is correct. By no means is this a trivial problem. I have been working on it, on and off, for the last six months. However, with the help of a great many friends and C programmers, I now have a working solution to this problem written in LV8.0 that is in beta test. The current solution starts with LW/CVI source code to create a DLL. The DLL is then called inside a LV program which also uses an Event Structure and User Events. So far I haven't been able to make it crash. My intention is to test it, finish it, document it, write it up and then submit it to NI as a User Solution.

If you are interested in playing a part in the beta testing just let me know. I will send you a LV llb file for you to try out.

Larry Goga




@Vedeja wrote:
Dear LabViewers!

I am stunned (and more importantly frustrated) over the fact that no one has, to my knowledge,

ever come up with a solution to get MIDI signals into LV! Surely, there must be more than 3 or 4

of us interested in the matter. So...a hero and the object for my lifelong adoration is the one who

presents me with a working solution! 😃 Obviously, I admit, I have failed in doing so myself.

 

/Stefan



Message 7 of 23
(11,240 Views)

Larry Loga!

I will test your beta with pleasure. Just let me know where to pick it up.

/Vedeja

PS. My email is in my profile

Message Edited by Vedeja on 11-05-2006 02:57 AM

0 Kudos
Message 8 of 23
(11,222 Views)
Stefan,

Your email address in not available in your user profile. I would really like to take this conversation off-line until I know that the code is working properly for all users. For security reasons NI would not release your address to me. I also hesitate to post my direct email address here, so I don't know how to proceed. Do you have any suggestions?

Thanks,

Larry Goga
0 Kudos
Message 9 of 23
(11,166 Views)
Larry!
Did you receive my email yet?
 
/Vedeja
0 Kudos
Message 10 of 23
(11,140 Views)