views:

205

answers:

3

Can Silverlight communicate with a MIDI instrument connected to the machine running the Silverlight application? In- or out-browser.

+2  A: 

It appears that this is not possible in Silverlight. To communicate with a MIDI device, you would have to PInvoke methods in winmm.dll, and this (apparently) cannot be done in Silverlight. See:

http://forums.silverlight.net/forums/t/123673.aspx

This could be done easily in a WPF or WinForms application. It could also be done in a browser with XBAP, although you would need elevated permissions to access the winmm API, which would require a certificate. You can also still make ActiveX controls with .Net, but I think you would still need a certificate for this to get the proper permissions (although it might work with just a scary security confirmation dialog).

MusiGenesis
A: 

Hello,

It's not possible to use .NET code directly in Silverlight because Silverlight has a different core.

All .NET classes that you want to reference in Silverlight need to be recompiled for Silverlight.

It's also not possible to access the underlying hardware directly, so i'm afraid you're stuck with a full-trust XBAP(you need to sign your app and the user will get an popup asking for permission). XBAP gives you all the .NET capabilities while running in the browser. XBAP will run on firefox/internet explorer on any >xp machine with .net 3.0 installed.

Hope this helps.

Jark
A: 

Silverlight 3 has an extensible multimedia pipeline for audio and video. You can procedurally create your own audio and play it. To implement what you want, you would have to write your own midi synthesizer.

Jeremiah Morrill
I don't want to play a midi, I don't want to emit any sound at all, I want to read midi from a midi instrument.
J. Pablo Fernández