i´m working on a project that lets me syncronize my synthesizer
to live played music by tapping in the speed with a pushbutton.
my question now is: is it possible to make the arduino act like a midi master and send a midi clock signal?
do i have to look for the midi specifics and use some normal pins for the interface or is there an midi interface already developed.
(like a driver ic)
but i want to calculate the clock speed by taping it in with a pushbuttn
and not regulating it with a potentiometer.
like this little thing does (i don't need the 3.4....and 1 function)
reading a button pres, checking the time, reading the button again checking the time again, calculate the time difference converting the time difference to BPM - now code that :-)
EDIT: I think someone on the forum made something similar, try searching the forum.
Hi,
I made a tap tempo clock a couple of weaks ago
Here’s the code:
/*
Tap Tempo clock
Ronald B
*/
void setup()
{
pinMode( 2, INPUT ); /* tap button - press it to set the tempo */
pinMode( 3, OUTPUT ); /* tempo display light - shows the current tempo */
}
int lastTapState = LOW; /* the last tap button state */
unsigned long currentTimer[2] = { 500, 500 }; /* array of most recent tap counts */
unsigned long timeoutTime = 0; /* this is when the timer will trigger next */
unsigned long indicatorTimeout; /* for our fancy "blink" tempo indicator */
void loop()
{
/* read the button on pin 12, and only pay attention to the
HIGH-LOW transition so that we only register when the
button is first pressed down */
int tapState = digitalRead( 2 );
Serial.println(tapState);
if( tapState == LOW && tapState != lastTapState )
{
tap(); /* we got a HIGH-LOW transition, call our tap() function */
}
lastTapState = tapState; /* keep track of the state */
/* check for timer timeout */
if( millis() >= timeoutTime )
{
/* timeout happened. clock tick! */
indicatorTimeout = millis() + timeoutTime; /* this sets the time when LED 13 goes off */
/* and reschedule the timer to keep the pace */
rescheduleTimer();
}
if( millis() < indicatorTimeout )
{
digitalWrite( 3, HIGH );
}
else
{
digitalWrite( 3, LOW);
}
}
unsigned long lastTap = 0; /* when the last tap happened */
void tap()
{
/* we keep two of these around to average together later */
currentTimer[1] = currentTimer[0];
currentTimer[0] = millis() - lastTap;
lastTap = millis();
timeoutTime = 0; /* force the trigger to happen immediately - sync and blink! */
Serial.println(lastTap);
}
void rescheduleTimer()
{
/* set the timer to go off again when the time reaches the
timeout. The timeout is all of the "currentTimer" values averaged
together, then added onto the current time. When that time has been
reached, the next tick will happen...
*/
timeoutTime = millis() + ((currentTimer[0] + currentTimer[1])/2);
}
I would love to make this a master Midi clock. SO please use it and maybe we can make this work. Let’s keep in thouch
I have an idea of taking it a bit further, with an accelerometer. How cool would it be to have an electronic conductor's baton, which would generate the tempo? You could then conduct your music live, complete with changes in tempo!
Could you share your idee a bit further, maybe it sounds silly but what's a "baton" (i'm dutch ;D)?
My ulitimate goal is a tempo controller that tracks my playing speed al the time. I think this could be done with an analog input. any idea's on that?