Yes you can absolutely do what you're talking about.
(Although you should probably redownload my library after last night's update so we're using the same version, sorry for the inconvenience)
First of all, to make Processing behave like a MIDI-input device in Logic. I'm going to assume we're on mac here, because logic doesn't exist on PC as far as I know. You'll want to set up an IAC bus on your mac. This is essentially a software MIDI bridge that will let you share MIDI from Processing to Logic. For this, open up the "Audio MIDI Setup" Application (under Application/Utilities). Click on "MIDI Devices", then click on "IAC Driver". Make sure the device is online (there should be a check box) and make sure there is at least one port in the list of ports (if not just click add port and make a new one). You should now have (at least) one IAC bus to send MIDI over. You can google IAC bus for more information about the IAC driver.
I will assume for my example that your IAC port was called "Bus 1" like mine.
When you run
MidiBus.list() you should see something like this:
Code:
Available MIDI Devices:
----------Input----------
[0] "IAC Driver - Bus 1"
[1] "Real Time Sequencer"
----------Output----------
[0] "IAC Driver - Bus 1"
[1] "Real Time Sequencer"
[2] "Java Sound Synthesizer"
In which case you processing sketch would be something like this (this is really vague, please tell me if you need more detail):
Code:
import processing.serial.*;
import themidibus.*;
MidiBus myBus;
Serial arduino;
void setup() {
//Set up your sketch and you arduino
//Set up so your arduino calls SerialEvent with new data
//Set up the MidiBus using your new IAC bus
myBus = new MidiBus(this, "", "IAC Driver - Bus 1");
}
void draw() {
//Important drawing stuff here
}
void serialEvent(Serial port) {
int data = 0;
//receive data here eg
//arduino.readStringUntil(20);
//or something similar
//Then you simply do this:
myBus.sendControllerChange(0, 0, data);
//or
myBus.sendNoteOn(0, 0, data);
//or something else similar
}
Sorry if that was kinda vague.
Sparky