We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProcessing DevelopmentLibraries,  Tool Development › The MidiBus MIDI library
Pages: 1 2 3 4 
The MidiBus MIDI library (Read 35059 times)
Re: The MidiBus MIDI library
Reply #30 - Oct 17th, 2009, 3:48pm
 
Hi, I'm trying to use a IAC bus port to send midi information to Ableton Live with your library. However, MidiBus.list(); never returns the IAC bus port as an option. I have the drivers and port enabled. I have also been able to accomplish my goal with Pure Data, but I would rather use the serial library, over PDuino for sonifying sensors, which is my end goal. Any thoughts on getting my IAC Bus Ports to display in the port list? Any other suggestions? Thank you for better documentation than the alternative libraries.
Re: The MidiBus MIDI library
Reply #31 - Oct 18th, 2009, 1:17pm
 
Figured it out. Needed MMJ Subsystem. Didn't know that IAC Buses would not appear without this. Should have read the project page. Works great now. Communicating with Live wonderfully, sonifying all my sensors like this is a snap. Glad I didn't use PD.  Smiley Thanks
Re: The MidiBus MIDI library
Reply #32 - Oct 20th, 2009, 9:09am
 
Hey Sparky,

I'm having trouble starting any sketch that includes a running instance of themidibus. Even the Basic.pde example won't start.

By commenting out sections, I think I have narrowed it down to any method involving midi-devices (such as MidiBus.list() or the midiBus-constructor called with more than one parameter). Without those, I can at least get the sketch to start. Otherwise the window won't even be created.

I'm on a Windows XP-machine with Midi Yoke installed and working.

Cheers, krqluld
Re: The MidiBus MIDI library
Reply #33 - Oct 21st, 2009, 4:51pm
 
I am having the same problem.  It just freezes and I have to hit stop.  No errors display in processing.  I had to revert back to my previous version of midibus.
Re: The MidiBus MIDI library
Reply #34 - Oct 22nd, 2009, 2:32am
 
I thought that might work, but I can't find a previous release. Where did you find yours?
Re: The MidiBus MIDI library
Reply #35 - Nov 18th, 2009, 6:35am
 
Anyone?
Re: The MidiBus MIDI library
Reply #36 - Nov 18th, 2009, 10:36am
 
Hi there Sparky, it's me again, back again with the midiBus... I was wondering if there's a way of sending the midi signals out to Flash... I need to build a bridge between a controller and flash...

i know this has nothing to do with the midibus library, but maybe you experimented with this and can guide me through a solution. Thanks A LOT
Re: The MidiBus MIDI library
Reply #37 - Nov 20th, 2009, 10:31am
 
bjlotus wrote on Nov 18th, 2009, 10:36am:
Hi there Sparky, it's me again, back again with the midiBus... I was wondering if there's a way of sending the midi signals out to Flash... I need to build a bridge between a controller and flash...

i know this has nothing to do with the midibus library, but maybe you experimented with this and can guide me through a solution. Thanks A LOT


I've found a solution for this, now i'm able to send midi msgs to flash.
I have a small doubt, if i define the in and out, for example:
Code:
myBus = new MidiBus(this, setMidiIn, setMidiOut); 


can i, when running the app, change those in and out settings on the fly (when i press a button)?

thanks
Re: The MidiBus MIDI library
Reply #38 - Nov 30th, 2009, 2:55pm
 
I'm attempting to use this library for a very simple task.

I'm running FL Studio and I want to be able to change multiple instruments volumes based on triggers in processing. The problem is my midi knowledge is minimal. I've tried using the "link to controller" option in FL Studio where I can separately link the volume knobs to different midi channels and controllers but I don't really know how to make the MIDI Bus effect these.

People are also talking about IAC buses, would I need to install one to get this going?

I'd appreciate any help and thank Sparky for such a wonderful library.

EDIT: Alright what I've done in FL Studio is link the volume knob to "controller 1" and "channel 3." In processing I put in a key pressed that uses a sendControllerMessage to manipulate the volume (Example: "sendControllerMessage(3, 1, 60)"). In FL Studio I assigned the input in the programs MIDI Settings as "SB Audigy 2 ZS MIDI IO [DD00]" and the output in processing as the same. It still doesn't work. Is there anything I'm missing? Here's my code:

Code:

import themidibus.*; //Import the library

MidiBus myBus; // The MidiBus
int myVolume = 60;
int myNumber = 3;
int myChannel = 3;
int myPitch = 64;

void setup() {
size(400,400);
background(0);
MidiBus.list(); // List all available Midi devices on STDOUT. This will show each device's index and name.
myBus = new MidiBus(this, "SB Audigy 2 ZS MIDI IO [DD00]", "SB Audigy 2 ZS MIDI IO [DD00]"); // Create a new MidiBus with no input device and the default Java Sound Synthesizer as the output device.
}

void draw() {
}

void keyPressed() {
 if(key == '=') {
   // up
   myVolume = myVolume + 1;
   fill(255, 0, 0);
   ellipse(width/2, height/2, myVolume, myVolume);
   myBus.sendControllerChange(myChannel, myNumber, myVolume);
 } else if(key == '-') {
   // down
   myVolume = myVolume - 1;
   fill(0, 255, 0);
   ellipse(width/2, height/2, myVolume, myVolume);
   myBus.sendControllerChange(myChannel, myNumber, myVolume);
 }
}
Re: The MidiBus MIDI library
Reply #39 - Dec 2nd, 2009, 11:25am
 
Ok using MIDI Yoke I was able to send a note on and a note off but for some reason I can't get it to change the volumes using the "Main Volume" Control Change. This is getting annoying lol.
Re: The MidiBus MIDI library
Reply #40 - Dec 3rd, 2009, 11:19am
 
Alright I got it to work finally (yes!). Partly because I'm an idiot and had an epiphany today in my Digital Synthesis class but also because FL Studio handles the channels oddly.

Here's what I did to get processing to communicate through MIDI to FL Studio just so other people don't run into many problems.
1. Install MIDI Yoke, this is a great MIDI routing application, I recommend it.
2. In FL Studio go to Options -> MIDI Settings (F10). Under "Input" select "In From MIDI Yoke:  1" and click the box that says "Enable" so that is lights up. You can leave the Controller Type as "generic controller."
3. In Processing first import the MIDI Bus library and create a MidiBus variable. For the sake of this example I'll be naming mine "myBus" per the basic example. Then assign a bus to your "myBus" variable with the output set to "Out To MIDI Yoke:  1" like so:
Code:
	myBus = new MidiBus(this, "", "Out To MIDI Yoke:  1"); // Create a new MidiBus with no input device and MIDI Yoke as the output device. 


4. Assign integers for "channel," "control number" and "velocity". I used "myChannel," "myNumber" and "myVolume." I have set myChannel to "0", myNumber to "7" and myVolume to "60."
5. In FL Studio go to the knob that you want Processing to influence, right-click and select "Link to controller..." Set the channel to whatever number you used for myChannel +1. Therefore I would set mine to "1" because I used "0." Set controller to the number you assigned to myNumber, I would used "7."
6. The last step is in Processing. Use a sendControllerChange command like so:
Code:
myBus.sendControllerChange(myChannel, myNumber, myVolume); 


7. Now test it out!

In my example below I have mapped the keys "+" and "-" to directly influence the volume of the knob. Keep in mind if you're not controlling volume you may want to rename your variables to something that makes more sense as to what you're attempting to change. Here's my code:
Code:
import themidibus.*; //Import the library

MidiBus myBus; // The MidiBus
int myVolume = 60;
int myNumber = 7;
int myChannel = 0; // Channel is +1 in FL Studio. i.e., 0 = 1, 1 = 2, etc.,
int myPitch = 64;

void setup() {
size(400,400);
background(0);
MidiBus.list(); // ===List all available Midi devices on STDOUT. This will show each device's index and name.
myBus = new MidiBus(this, "", "Out To MIDI Yoke: 1"); // Create a new MidiBus with no input device and MIDI Yoke as the output device.
}

void draw() {
}

void keyPressed() {
if(key == '=') {
// up
myVolume = myVolume + 1;
fill(255, 0, 0);
ellipse(width/2, height/2, myVolume, myVolume);
myBus.sendControllerChange(myChannel, myNumber, myVolume);
} else if(key == '-') {
// down
myVolume = myVolume - 1;
fill(0, 255, 0);
ellipse(width/2, height/2, myVolume, myVolume);
myBus.sendControllerChange(myChannel, myNumber, myVolume);
}
}


Hopefully this helps anyone that's having trouble communicating with FL Studio. The tricky part was figuring out that FL Studio operates 1 channel above the MIDI Bus channel. I couldn't find anything directly related to this subject and I hope I'm not the only one attempting to do this Smiley
Re: The MidiBus MIDI library
Reply #41 - Dec 12th, 2009, 11:57am
 
Hey djcubez, bjlotus, krqluld

Sorry I haven't responded to all your posts, normally I try and be diligent and answer any question, but e-mail notification seems to not be working grrr. Anyways swamped this week but I will return after that and see if I can help out (although you guys seem to be working it out on your own).

Sparky
Re: The MidiBus MIDI library
Reply #42 - Dec 12th, 2009, 12:02pm
 
Also in regards to the problem with the december 3rd mac os 10.5 and 10.6 java update. As per This topic. The MidiBus has been updated to fix the bug due to this.

Simply install the latest version of the MidiBus and uninstall mmj (details on the midibus page if you're unsure how to do that)

Please e-mail me if you're still having issues, as this was very cursory debug/fix

Sparky
Re: The MidiBus MIDI library
Reply #43 - Dec 12th, 2009, 4:33pm
 
Hi Sparky,

First of all, thanks for making the MidiBus!  Second of all, apologies if my question is stupid, I am very much a beginner in Processing I'm afraid.

I am in the midst of trying to make a little robot to play a toy glockenspiel.  I want to get midi input using the midibus, then send the pitch value on to an Arduino microcontroller powering a number of servos. the choice of servo will depend on the pitch data coming from Processing.

I tried adapting your "Basic" example by adding a line to write to the serial port (using the Processing serial library).  However when I press a midi key I get the following error message:

Quote:
The MidiBus Warning: Disabling noteOn(int channel, int pitch, int velocity) because an unkown exception was thrown and caught java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25) at java.lang.reflect.Method.invoke(Method.java:592) at themidibus.MidiBus.notifyPApplet(MidiBus.java:1023) at themidibus.MidiBus$MReceiver.send(MidiBus.java:1510) at com.sun.media.sound.AbstractMidiDevice$TransmitterList.sendMessage(AbstractMidiD
evice.java:675) at com.sun.media.sound.MidiInDevice.callbackShortMessage(MidiInDevice.java:158) at com.sun.media.sound.MidiInDevice.nGetMessages(Native Method) at com.sun.media.sound.MidiInDevice.run(MidiInDevice.java:126) at java.lang.Thread.run(Thread.java:613) Caused by: java.lang.NullPointerException at Basic.noteOn(Basic.java:60) ... 11 more


not sure what to make of that but I'm hoping it's really obvious to those in the know, i.e. you!

would really appreciate any pointers.
thanks very much.

Patrick
Re: The MidiBus MIDI library
Reply #44 - Dec 12th, 2009, 8:31pm
 
This error most likely indicates a problem inside the noteOn method of your sketch, can you post what you were doing?

Sparky
Pages: 1 2 3 4