Skip to content

Conversation

nsowen
Copy link

@nsowen nsowen commented May 24, 2020

Thanks for CoreMidi4J, it is in fact really nice work and I love using it.

Today I was looking for a Java API for creating virtual MIDI input ports for creating software that can receive MIDI events from other applications without having to use the Apple IAC device.

Unfortunately, this is obviously not supported by the Java Sound API, nor did I find a good and clean way of adding this to CoreMidi4J without breaking with the fundamental APIs. So I decided to take a more hacky, but minimal-invasive approach by simply adding this to the existing CoreMidiInputPort code and use a static method in CoreMidiSource.

Example:
CoreMidiSource virtualDevice = CoreMidiSource.createVirtualDevice("My virtual device");

// no-op here
virtualDevice.open();

// receive MIDI from Logic / MainStage / etc.

// close and do a clean disposal of the destination in CoreMidi
virtualDevice.close();

There are probably other and more better ways of implementing this, but anyway, maybe you will find this useful.

Sorry for the spacing changes, I couldn't keep IntelliJ from fixing the whitespaces.

@DerekCook
Copy link
Owner

Apologies for the delay in replying, life is manic. Thanks for the comments on CoreMIDI4J and providing the suggested change.

I'm a bit nervous when you mention the breaking of APIs whether or not that breaks CoreMIDI4J working with our applications, so we need to be a little cautious. Whilst you also mention taking the least invasive approach, that still makes me nervous!

It's a bit hard to see at a glance what all the changes are, so will need to work through it in slower time when we get a chance.

It might be useful if you can provide as a use case of what you are trying to achieve in terms of interapp comms that require a virtual approach, and then perhaps we are in a better position to review your proposed change and if it is the best implementation for that.

@brunchboy
Copy link
Collaborator

Thanks for responding, Derek. I’ve been waiting since this is mostly your project, but my initial reaction was that this is something outside the core purpose of CoreMidi4J, and should probably be handled by a separate project. It is also unclear to me why one would want to not simply use the MIDI IAC mechanism that Apple already offers for this purpose.

@nsowen
Copy link
Author

nsowen commented Nov 16, 2021

Apologies, I lost track of your responses.

Thanks for the feedback.

Here's my usecase:
I wanted to control our Behringer X32 mixing desk live using my Midi hardware controllers, mainly for changing montoring or FX mix while playing live. After trying several solutions, I stumbled across CoreMidi4J.

So, I created a Java App that, while running, opens a Virtual Midi-Input-Port using this extension to CoreMidi4J.
The software will receive Midi Controllers from Main Stage, translates them into OSC commands, and sends it over the WIFI directly to the Behringer X32 OSC input port. Works perfectly for a year now.

I thought, since the CoreMidi API itself provided this API method https://developer.apple.com/documentation/coremidi/1495347-mididestinationcreate
it would be an addition to CoreMidi4J and I liked the idea having that ready "out of the box" without the need of preparing the IAC for that.

Anyway, thanks for responding!

@DerekCook
Copy link
Owner

Hi, will take a look some time, but my first observation is that you have used a deprecated function, so maybe it is best to fix that first before we look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants