Sending MIDI information to my DAW

Hello!

I want to send data from my sketch into my DAW, more specifically, Logic Pro X, using the midiBus library, but I do not know how to access the appropriate midi channel to make this happen. When I create an Aggregate or Multi Output device in the Audio Midi Setup of my Mac, it is not recognized by the MidiBus().list function on processing. Does anybody with any experience on this can help? Has anybody successfully linked up Processing with Logic Pro X, or any other DAW for that matter (assuming that the general principles translate)?

Thank you.

Hi! Funny: a similar question from yesterday but for Linux:

I link it here in case some of the tips are useful on Mac too.

1 Like

Similar, but the answer I gave was quite Linux specific (although JACK does have a Mac build)

@LordCacops firstly have you set up a MIDI loopback / virtual port? Eg. http://www.johanlooijenga.com/tools/12-virtual-ports.html Not quite sure from your post.

Secondly, you may like the other post be finding one of the limitations of JavaSound MIDI. It used to be very limited on Mac although has improved a bit. Because of that I know there are a few alternative JavaSound MIDI implementations around. I haven’t tried it but you could have a look at https://github.com/DerekCook/CoreMidi4J

Wow, this looks promising.

I created a virtual port. It was not detected by the “Basic” sketch among the MidiBus’ examples. I figured thats because of the limitations of JavaSound MIDI, so I installed the CoreMidi4J. For its installation it is needed that I place the .jar file on the class path of the project with which I want to use it. Im a total beginner so I don’t even know what a class path is, or for that matter where it is. And also, by the project do they mean the sketch from which I am trying to output the MIDI messages?

As this is a plain Java library rather than a Processing specific one, possibly have a read of https://github.com/processing/processing/wiki/How-to-Install-a-Contributed-Library

I placed the file on the libraries folder, with the library containing the .jar named like the .jar minus the extension. I tried to import it into the Basic.pde example of the MidiBus library. And yet, I cannot import the CoreMidi4J.

import themidibus.*; //Import the library
import coremidi4j.*;

the error message says: The import coremidi4j cannot be resolved

That’s not what import actually does, and you shouldn’t need that line at all. Just having the jar there should hopefully improve what MIDI devices are available.

This comes out at the console:

Available MIDI Devices:
----------Input----------
[0] “Real Time Sequencer”
----------Output----------
[0] “Gervill”
[1] “Real Time Sequencer”

The MidiBus Warning: No available input MIDI devices named: “IAC Driver To Logic” were found

I set the MIDI port as prescribed in this article:
http://www.johanlooijenga.com/tools/12-virtual-ports.html

as you can see from the screenshot.

I read in the aforementioned thread that is similar to this one (MIDI: from Processing to Daw (Linux)) about the implementation of JACK Audio Connection Kit. I believe you developed its MIDI implementation @neilcsmith. Could you tell me about this? Is this a library, or something that could be used in tandem with MidiBus?

if you want address a other user it helps to use @neilcsmith
as this pops up in the Notifications

2 Likes

I wrote the Java binding for JACK, not JACK itself, and a lot of the MIDI support in the bindings came from someone else - JACK’s primary use is routing real time audio across applications.

You can find an example of JACK MIDI-through in the JAudioLibs examples. It’s lowlevel stuff, but not that difficult. There is no JavaSound MIDI device implementation on top of it, although you could theoretically write one, so out of the box it won’t work with MidiBus.

I’ve not used CoreMidi4j but from the readme, if you’re not seeing extra devices with the coremidi4j prefix then I don’t think you have it installed correctly. :confused:

Sharing this in case it helps… I have midi messages being successfully sent from Processing to Logic Pro X, without needing to download any extra tools. Here’s the steps I followed:

  1. Ran MidiBus.list() and confirmed that the standard default output devices [0] Gervill and [1] Real Time Sequencer were showing up in the console
  2. Went to audio midi setup on my mac -> Window -> show MIDI studio
  3. Clicked in to the IAC driver -> ticked box for “Device is online”
  4. Renamed the port to Processing to DAW
  5. Ran MidiBus.list() again in Processing, and saw the new option Processing to DAW in the console

That was a good checkpoint, confirming that I had created a “virtual midi cable” to send midi messages between applications.

Then I verified that the midi messages were being received in my DAW:

  1. Opened Logic Pro X and changed the graphical display to custom (top middle of screen -> gear icon -> custom)
  2. Ran some sample code in Processing that sent a midi note and a control message regularly
  3. Confirmed that the midi messages were popping up in the graphical display in Logic
  4. Added a software instrument track and heard my midi note from Processing being played by the instrument (without needing to do any configuration)

Yes! Logic is now beeping alright. This was quite easy. I think what I was missing was ticking “Device is Online”. Thanks a bunch for the help!