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.
IndexProgramming Questions & HelpSound,  Music Libraries › store or record Midi value
Page Index Toggle Pages: 1
store or record Midi value (Read 1309 times)
store or record Midi value
May 25th, 2010, 3:26am
 
Hello everybody,

I try to connect 2 midi values to compile a midi mapping. the first value received from the software and the second from a midi controller. I use the midibus library to read the values.
my problem at the moment is the record of the 2 values. anyone any ideas???

thnx a lot,
regards schnemann
Re: store or record Midi value
Reply #1 - May 25th, 2010, 9:43am
 
to get a bit closer into the topic here is the current code. i´m a newbee in processing and the code is maybe really rude for you...sorry... I tried to create a array for saving the receiving midi value. i think the buttons are also not the best solution at the moment, but this could be correct later.

Code:
import themidibus.*; 
import controlP5.*;

PFont myFont;

MidiBus Software_Input;
MidiBus Controller_Input;
MidiBus Linked;
ControlP5 controlP5;

boolean Software;
boolean Controller;

int [] channelA;
int [] channelB;


void setup() {
 size(300, 200);
 background(50);
 stroke (150);
 line (0, 30, 300, 30);
 
 channelA = new int [8];
 channelB = new int [8];
 
 

//MIDI
 MidiBus.list(); // List all available Midi devices
 Software_Input = new MidiBus(this, 0, 0); // Create a new MidiBus using the device index
 //myBus = new MidiBus(this, "IncomingDeviceName", "OutgoingDeviceName"); // Create a new MidiBus using the device names
 Controller_Input = new MidiBus(this, 2, 0); // Create a new MidiBus using the device index
 
//FONT
 // Uncomment the following two lines to see the available fonts
 // String[] fontList = PFont.list();
 // println(fontList);
 myFont = createFont("TradeGothicLTCom-BdCn20", 12);
 textFont(myFont);
 fill (240);
 text("MIDI MAPPING Mock-Up", 50, 20);

//Buttons  
 controlP5 = new ControlP5(this);
 controlP5.addToggle("Software", false, 60, 50, 20, 20);
 controlP5.addToggle("Controller", false, 60, 100, 20, 20);
 controlP5.addToggle("Linked", false, 60, 150, 20, 20);

}

void draw() {
 
 
 
 for (int i = 0; i< channelA.length; i++) {

 }
 
}
 
void noteOn(int channel, int pitch, int velocity) {
 // Receive a noteOn
 println();
 println("Note On:");
 println("--------");
 println("Channel:"+channel);
 println("Pitch:"+pitch);
 println("Velocity:"+velocity);
}

void noteOff(int channel, int pitch, int velocity) {
 // Receive a noteOff
 println();
 println("Note Off:");
 println("--------");
 println("Channel:"+channel);
 println("Pitch:"+pitch);
 println("Velocity:"+velocity);
}

void controllerChange(int channel, int number, int value) {
 // Receive a controllerChange
 println();
 println("Controller Change:");
 println("--------");
 println("Channel:"+channel);
 println("Number:"+number);
 println("Value:"+value);
}


thnx again...
Page Index Toggle Pages: 1