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 › linking visuals to sound
Page Index Toggle Pages: 1
linking visuals to sound (Read 820 times)
linking visuals to sound
Mar 22nd, 2008, 4:20am
 
Hi :) - I just started learning the processing language and I'd like to tackle the MIDI interfacing too. My first goal is to create a basic triggering program that can match visuals with incoming MIDI messages. Where is a good place to start learning? (reading forum posts, a guide, program manual.. etc)

Re: linking visuals to sound
Reply #1 - Mar 22nd, 2008, 3:12pm
 
hi,
you can use the proMidi library
http://processing.org/reference/libraries/index.html
it has simple demos something like balls appearing in places with respect to your note and color with respect to the expression. please message me if it works and what i got. i tried it too but my interface was crappity smacking unreliable.
cheers, ra
Re: linking visuals to sound
Reply #2 - Jun 3rd, 2008, 1:29am
 
Thanks Tex - I see the inputs

Figured I'd continue in this original post -- Hope this helps anyone with little programming knowledge like me-

I'm a little confused about it where the velocity and pitch information are entered in the program example --

What I want to achieve is this simple IF statement:

*IF midi note X is received with velocity between A and B* - --- do this.. ( in this case its the ellipse)


lets say the midi note value is 40 - and the velocity needs to be between 60 and 127 --  how would I work that out in this code:


import promidi.*;

MidiIO midiIO;

void setup(){
 size(128*5,128*5);
 smooth();
 background(0);
 
 midiIO = MidiIO.getInstance(this);
 println("printPorts of midiIO");
 midiIO.printDevices();
 midiIO.openInput(0,0);
}

void draw(){

}

void noteOn(
 Note note,
 int deviceNumber,
 int midiChannel
){
 int vel = note.getVelocity();
 int pit = note.getPitch();
 
 fill(255,vel*2,pit*2,vel*2);
 stroke(255,vel);
 ellipse(vel*5,pit*5,30,30);
}

Re: linking visuals to sound
Reply #3 - Jun 5th, 2008, 11:07am
 
just after you retrieve the pitch and velocity:

Code:
if (pit == 40 && vel > 60 && vel < 127) {
// do this
}
Page Index Toggle Pages: 1