Transmitting MIDI events from JUCE app to Unity3D app

I'm planning to use Unity3D to make visualisations, so my JUCE app emits noteOn&offs and my Unity app receives them.

Can anyone see a good way of doing this?

I'm imagining using localhost sockets and wiring a port, then using UDP -- slightly dreading it TBH as I find socket programming slippery, there doesn't seem to be any good learning resource.

If anyone has dealt with the same kind of scenario, some kind of overview would be really appreciated!


PS I may end up doing sections of the UI (or maybe the whole thing) in Unity, I should find some solution that supports bidirectional Communication. Eventually I will look at integrating, but I know that's going to be headache, and I can make better R&D tools by keeping components separate.

Easy to do if you're on os x!

I'm going to go for a multiplatform solution.

I think I can ignore the fact that it is MIDI, I can just send raw packets containing {MIDI note, velocity} <-- this looks promising.


Or maybe the InterprocessConnection class would work?

I'd go for JUCE's OSC in the C++ part and a .NET OSC implementation Unity.

With a little luck the implementation you choose does not do anything that Unitys iOS export does not like ( jit! ) and it will "just work" out of the box on all platforms. was the first hit that came up and it looked alright from a quick glance.

I worked with both, Unity & JUCE during the last years, and I'd try avoiding making a native plugin for unity that contains the JUCE code. It's certainly doable, but you better have a good reason to jump through all the hoops - probably not worth it for something as simple as sending MIDI data over UDP. 


I'd agree with beschulz as the best solution.

But if you want some code, I have some old (read as "not very tidy" smiley) code that works using TCP to set up a connection between Unity and a JUCE app. I've been using it for the past six years or so to help teach game audio and game audio programming. TCP seems fast enough even to report rapid machine gun fire events and multiple game objects dynamically moving in space and keep good timing. I always had it as a "to do" to convert it to UDP although I'd go the OSC route now.

OSC!! :D

So glad that's in JUCE now.  

Thanks for the offer!

After sleeping on it, I've decided to use JUCE for my GUI at least until I have a prototype ready, as using Unity introduces a bunch of headaches.