@lcpcarter wrote:
Hi,
I am trying to create a generative audio piece where when objects collide, midi information if sent from OF to Ableton Live. I have everything connected and making sound but currently I can’t figure out how to stop the midi messages from bring sent - I just want one note played as if playing a keyboard.
This is my midi out code currently:
void ofApp::sendMidi(vectorboids, RedMouse _rm) {
for(int i = 0; i < boids.size(); i++) {
float distance = ofDist(_rm.location.x, _rm.location.y, boids[i].position.x, boids[i].position.y);
if (distance < 20 && distance > 0) {
noteVelocity = 80;
midiOut.sendNoteOn(channel, note, noteVelocity);
midiOut.sendNoteOff(channel, note, noteVelocity);
}
}
}RedMouse is just a circle around my mouse’s x and y location and boids are for playing with flocking down the line. Both have a radius of 20, hence the amount of distance I am calculating. so the whole time that the objects are overlapping, midi messages are continually sent, making a horrible noise. I have tried making the distance just 1 but it then means the likelihood of midi messages being sent is very slim.
Any thoughts, code pointers would be greatly appreciated.
Thanks.
Posts: 2
Participants: 2