Hey everybody,
me again with a new problem , I hope someone can help me. I have searched around the internet for a while,
but it still seems that Teensy, despite its amazing usb.midi library still is a bit complicated when it comes to syncing to
the clock/bpm of DAWs, in my case Ableton Live. (In the long run, would it be possible to just add that as a function to the library?)
In my case I would like to use a gestural controller to control the bpm in Ableton Live after it is switched on, however, when switching it off,
I want to to jump back to the original bpm value. Therefore it is not enough for me to simply map the bpm with a pitch control,
but I need my Teensy board to know at any give point what the current Ableton Live bpm is. I have copied/pieced together (mostly copied..) this code here, some I found on the forum:
So far I can send midi notes and flash the led on/off along with the Ableton bpm. However, and I think this is simply because of my little knowledge when it comes to programming, I cannot extract the time interval from those events to then calculate a bpm. I am not sure why, but when I set click1time=millis in the lower functions, i dont get anything in the main loop... rookie mistake?
I would be very thankful if someone could give me some advice on how to extract the time difference between clicks in the main loop, it really shouldn't be so difficult, right?
Generally, would it not be very useful to add a bpm read function for the main DAWs to the teensy library, not just a clock, but a bpm serial read-out, (Ableton, Cubase, etc)? Everybody I know working with teensy as a midi controller (..three people haha..) runs into that problem at some point, and it seems like such a basic thing for anybody working with arpeggiators, controls, etc.
As usual, thank you in advance!
me again with a new problem , I hope someone can help me. I have searched around the internet for a while,
but it still seems that Teensy, despite its amazing usb.midi library still is a bit complicated when it comes to syncing to
the clock/bpm of DAWs, in my case Ableton Live. (In the long run, would it be possible to just add that as a function to the library?)
In my case I would like to use a gestural controller to control the bpm in Ableton Live after it is switched on, however, when switching it off,
I want to to jump back to the original bpm value. Therefore it is not enough for me to simply map the bpm with a pitch control,
but I need my Teensy board to know at any give point what the current Ableton Live bpm is. I have copied/pieced together (mostly copied..) this code here, some I found on the forum:
Code:
// originally, Teensyduino MIDI Beat Clock Example
// by Sebastian Tomczak
// 29 August 2011
byte counter;
byte CLOCK = 248;
byte START = 250;
byte CONTINUE = 251;
byte STOP = 252;
int x = -1;
unsigned long millisTime=0;
unsigned long click1Time=0;
unsigned long click2Time=0;
bool clickTime;
unsigned long beatTime=0;
void setup() {
Serial.begin(31250);
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
usbMIDI.setHandleRealTimeSystem(RealTimeSystem);
}
void loop() {
delay(50);
usbMIDI.read();
millisTime = millis();
click2Time-click1Time==beatTime;
Serial.print(clickTime);
Serial.print(" ");
if (clickTime==true) click1Time=millisTime;
if (clickTime==false) {
millisTime-click1Time==beatTime;
Serial.print(" click1Time: ");
Serial.print(click1Time);
Serial.print(" millis Time: ");
Serial.println(millisTime);
}
}
void RealTimeSystem(byte realtimebyte) {
unsigned long millisTime;
if(realtimebyte == 248) {
counter++;
if(counter == 23) {
digitalWrite(13, LOW);
usbMIDI.sendNoteOff(64, 100, 1);
clickTime=false;
}
if(counter == 24) {
counter = 0;
usbMIDI.sendNoteOn(61, 100, 1);
clickTime=true;
}
if(counter == 12) {
}
if(counter == 11) {
digitalWrite(13, HIGH);
Serial.println("HIGH");
}
}
if(realtimebyte == START || realtimebyte == CONTINUE) {
counter = 0;
digitalWrite(13, HIGH);
Serial.println("START");
}
if(realtimebyte == STOP) {
digitalWrite(13, LOW);
Serial.println("STOP");
}
}
So far I can send midi notes and flash the led on/off along with the Ableton bpm. However, and I think this is simply because of my little knowledge when it comes to programming, I cannot extract the time interval from those events to then calculate a bpm. I am not sure why, but when I set click1time=millis in the lower functions, i dont get anything in the main loop... rookie mistake?
I would be very thankful if someone could give me some advice on how to extract the time difference between clicks in the main loop, it really shouldn't be so difficult, right?
Generally, would it not be very useful to add a bpm read function for the main DAWs to the teensy library, not just a clock, but a bpm serial read-out, (Ableton, Cubase, etc)? Everybody I know working with teensy as a midi controller (..three people haha..) runs into that problem at some point, and it seems like such a basic thing for anybody working with arpeggiators, controls, etc.
As usual, thank you in advance!