OSX 10.7 and MIDI Sysex

847 views
Skip to first unread message

John

unread,
Oct 16, 2012, 3:22:39 AM10/16/12
to over...@googlegroups.com
I'm having some trouble getting my OSX machine to send MIDI sysex messages using both overtone.midi/midi-sysex and (if the Java test code I'm using is correct) Java too.
However, the same code based on the overtone.midi wrapper works just fine on my Win7 computer.

I've read in a few places (historically anyway) that there was/(might be?) issues with the Apple supplied java sysex implementation.
However, in the past, I have mucked around with my OS X machine's Java installation, so I don't want to rule out "user-configuration-error" just yet.

It would be very helpful if someone on the list could confirm that overtone.midi/midi-sysex works as expect on OS X.

Thanks for reading,
-John



Sam Aaron

unread,
Oct 16, 2012, 3:37:28 AM10/16/12
to over...@googlegroups.com
Hi John,

On 16 Oct 2012, at 08:22, John <jo...@brinko.com> wrote:

> It would be very helpful if someone on the list could confirm that overtone.midi/midi-sysex works as expect on OS X.

I can confirm that I can successfully send MIDI sysex messages on OS X.

For example, this works as expected:

https://github.com/overtone/overtone/blob/master/src/overtone/device/midi/nanoKONTROL2.clj#L163

This is on Java 1.6 under OS X 10.8.2

Sam

---
http://sam.aaron.name

John

unread,
Oct 16, 2012, 7:32:34 PM10/16/12
to over...@googlegroups.com
Thanks for the info Sam, I kept digging...

I found a workaround for my system, hip hip!  But unfortunately, I also found more anecdotal evidence suggesting that Apple's MIDI support for Sysex (on my system anyway) is broken.  I'm running 10.7.5 and Java 1.6.0_35.

If anyone else runs into this problem, here's the workaround:

What: Add a javax.sound.midi service provider to your system that properly implements all of the CoreMIDI services.
How: Download mmj.zip from: http://www.humatic.de/htools/mmj.htm and copy libmmj.jnilib and mmj.jar into /Library/Java/Extensions.  Pick the correct files for your arch. x64, or x32.  Don't forget to restart the REPL or what ever you are doing.

Once done, you will see two instances of your midi devices.  I used the REPL and the (overtone.midi/midi-out) function to inspect each instance of my MIDI devices.  You must use the device exposed by the new service provider.  Here's what I saw for my M-Audio Uno:

Broken Apple midi-out info:
{:receiver #<MidiOutReceiver com.sun.media.sound.MidiOutDevice$MidiOutReceiver@59596138>, :name "Port 1", :description "USB MIDI 1x1 Port 1", :vendor "M-Audio", :version "Unknown version", :sources 0, :sinks 2147483647, :info #<MidiOutDeviceInfo Port 1>, :device #<MidiOutDevice com.sun.media.sound.MidiOutDevice@201787a6>}

The new humatic midi-out info:
{:receiver #<CoreMidiReceiver de.humatic.mmj.spi.CoreMidiDeviceImpl$CoreMidiReceiver@281827c9>, :name "USB MIDI 1x1 - Port 1", :description "Port 1", :vendor "M-Audio", :version "1.0", :sources 0, :sinks 2147483647, :info #<JSMDevInfo USB MIDI 1x1 - Port 1>, :device #<CoreMidiDeviceImpl de.humatic.mmj.spi.CoreMidiDeviceImpl@378a4aef>}


I found that this document explains how all this stuff works:  http://docs.oracle.com/javase/tutorial/sound/SPI-intro.html 

-John

pascalc

unread,
Feb 17, 2014, 2:44:04 PM2/17/14
to over...@googlegroups.com
Hi,

A bit late.. but as you are discussing Sysex messages in Java on Mac OS X I thought I could just mention the osxmidi4j project that I'm maintaining on https://github.com/locurasoft/osxmidi4j.

There are detailed usage instructions in the README file but you can use the library either as a bundled jar in your Java application or simply copy it to /Library/Java/Extensions for local use. Then all Java applications will get access to MIDI sysex functionality on your machine.

BR
/Pascal

James Elliott

unread,
Jun 2, 2015, 9:22:51 PM6/2/15
to over...@googlegroups.com
Thanks for this! I just submitted a pull request that enhances it to use a temporary directory when it needs to deploy a local copy of librococoa.dylib, and sets up the MIDI notifier on the main Cocoa event loop, which fixes auto-detection of changes to the MIDI environment (i.e. you connect or disconnect a MIDI device after starting Java). Now both of my issues with MIDI on Mac Java are resolved!

James Elliott

unread,
Jun 6, 2015, 3:44:41 PM6/6/15
to over...@googlegroups.com
Sadly, I spoke a bit too soon. While I was able to patch osxmidi4j to get hot-plugging of devices working, and its implementation of MIDI on the Mac does support SysEx correctly, it turns out to not be suitable as a Java extension: It embeds way too much software, such as particular versions of logging frameworks, asm, cglib, and JNA, many of which are fundamental to the approach it used for communicating with Objective C (rococoa, which appears to be an abandoned project itself at the moment).

Putting that bundle of joy in your Java extension path causes many other products (which are not even trying to use MIDI) to blow up spectacularly.

So I have had to switch to using Humatic’s mmj, http://www.humatic.de/htools/mmj.htm which is still freely available, but has been discontinued. It uses the right approach to building a Java extension, which is a focused, minimal set of classes, which do not conflict with libraries on which other software is built. Unfortunately, it suffers from the problem that I had to patch osxmidi4j to solve, in that it does not react to the connection or removal of MIDI devices after Java has started up. I could probably fix it in the same way that I fixed osxmidi4j, but unfortunately it is not open source. I have sent a plea to the company asking if they would consider releasing the source, since it has been discontinued since 2009, so that I and others can take over the task of maintaining it, but who knows if they will be amenable to that idea.

In the mean time, I can limp along with mmj, which solves my main problem (the need to send SysEx messages), and if they are not willing to release the source, I may have to spend a few weeks writing a bunch of tedious JNI code to recreate the library myself in an open-source manner. Or wait for Oracle to fix the problems, but they have punted it to Java 9, which follows a pattern that does not make me optimistic it will be actually fixed then either.

James Elliott

unread,
Jan 9, 2016, 11:53:18 PM1/9/16
to Overtone
I am happy to report that there is now a clean, up-to-date fix for this issue approaching release candidate status: check out CoreMIDI4J and see if it lets you do what you need.

Jo...@effigylabs.com

unread,
Jul 10, 2018, 3:34:55 PM7/10/18
to Overtone
Sorry for the necroposting, but here I am in 2018 seeing the same problem.  I can presume the MAC OS MIDI Sysex support is still broken as of 10.11.6?  If I am to do Sysex, I must use a more fully implmeneted set of MIDI libraries such as CoreMIDI4J, is this the current understanding?
Thanks
JR

James Elliott

unread,
Jul 10, 2018, 3:40:53 PM7/10/18
to over...@googlegroups.com
That is correct, assuming you are talking about doing it from Java/Clojure. And there are other advantages that CoreMIDI4J now gives you, like hot-plugging of MIDI devices after the JVM starts up.

-James

--
You received this message because you are subscribed to a topic in the Google Groups "Overtone" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/overtone/Q0hLAoOfjEc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to overtone+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Elliott

unread,
Jul 10, 2018, 3:45:17 PM7/10/18
to Overtone
And with respect to necroposting, a lovely neologism I had not previously encountered: two years later is no time at all with respect to this problem. It has been an issue for nearly two decades at this point, and I don’t have any reason to believe it will ever change.


On Tuesday, July 10, 2018 at 2:40:53 PM UTC-5, James Elliott wrote:
That is correct, assuming you are talking about doing it from Java/Clojure. And there are other advantages that CoreMIDI4J now gives you, like hot-plugging of MIDI devices after the JVM starts up.

-James

On Jul 10, 2018, at 14:31, Jody wrote:

Sorry for the necroposting, but here I am in 2018 seeing the same problem.  I can presume the MAC OS MIDI Sysex support is still broken as of 10.11.6?  If I am to do Sysex, I must use a more fully implmeneted set of MIDI libraries such as CoreMIDI4J, is this the current understanding?
Thanks
JR

On Saturday, January 9, 2016 at 10:53:18 PM UTC-6, James Elliott wrote:
I am happy to report that there is now a clean, up-to-date fix for this issue approaching release candidate status: check out CoreMIDI4J and see if it lets you do what you need.

On Tuesday, October 16, 2012 at 2:22:39 AM UTC-5, John wrote:
I'm having some trouble getting my OSX machine to send MIDI sysex messages using both overtone.midi/midi-sysex and (if the Java test code I'm using is correct) Java too.
However, the same code based on the overtone.midi wrapper works just fine on my Win7 computer.

I've read in a few places (historically anyway) that there was/(might be?) issues with the Apple supplied java sysex implementation.
However, in the past, I have mucked around with my OS X machine's Java installation, so I don't want to rule out "user-configuration-error" just yet.

It would be very helpful if someone on the list could confirm that overtone.midi/midi-sysex works as expect on OS X.

Thanks for reading,
-John




--
You received this message because you are subscribed to a topic in the Google Groups "Overtone" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/overtone/Q0hLAoOfjEc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to overtone+unsubscribe@googlegroups.com.

Jo...@effigylabs.com

unread,
Jul 11, 2018, 1:05:56 PM7/11/18
to Overtone
Thanks James.  I was able to use your library right away.  Your documentation was straightforward and everything worked.   I am using Netbeans to develop a MIDI control panel that must run on mac, windows, and other platforms.  Disappointing - no, make that floored - that the Apple MIDI System implementation is missing such an important piece, but encouraging that there was such a great solution. Check us out if you like at https://EffigyLabs.com, thanks again Sir.
-James

To unsubscribe from this group and all its topics, send an email to overtone+u...@googlegroups.com.

James Elliott

unread,
Jul 11, 2018, 1:14:39 PM7/11/18
to Overtone
Thanks for the kind words, I will take a look at your control panel when I have a chance (a bit busy at work right now). We definitely put some effort into refining how CoreMidi4J is packaged and loaded to make it as easy as possible to adopt, so I am glad to hear your experience has validated that effort.

I would also like to clarify that the Apple MIDI implementation has always been excellent, and available as a core system feature since before any other platform. The problem has always been with Java’s attempts to interact with it, and this has never been a priority for Sun or Oracle.

Cheers,
  -James
Reply all
Reply to author
Forward
0 new messages