-
Notifications
You must be signed in to change notification settings - Fork 27
Midi-Clock - In, Slave) #13
Hi, i already modified the code a bit to get a sync to the internal MIDI in Volca-Beats. I am not the "master" of github, I will create a side-project to share the code with You. My Acidbox already sync to TD3 but still 3 x 303 != 909.
All reactions
Replies: 3 comments
I changed this in AcidBanger to get a "slave" ...
I ́ll try to get a version which works autonomous or as a slave, depending on receiving clock and pressed buttons..
We do not need an internal MIDI-Tick if an eexternal clock it ticking.
I added a new general boolean:
ext_midi_clock_master
void run_tick() {
/* Run button scan at 250 Hz */
now = millis();
button_divider++;
if (button_divider >= 4) {
for (int i = 0; i < ButLast; i++) {
read_button( &buttons[i] );
}
run_ui();
button_divider = 0;
}
/* If MIDI is playing, then check for tick */
if ( ext_midi_clock_master==false && midi_playing && (now - last_midi_tick) >= midi_tick_ms ) {
do_midi_tick();
last_midi_tick += midi_tick_ms;
if (last_midi_tick < now) {
/* we are at least one tick late, give up */
last_midi_tick = now;
}
}
}
In the part for the UI inside run_ui:
// Handle play
if (just_pressed(ButPlay)) {
if (midi_playing) {
#ifdef DEBUG_JUKEBOX
DEBUG("stopping midi");
#endif
do_midi_stop();
} else {
#ifdef DEBUG_JUKEBOX
DEBF("starting midi clock, dt=%lu", midi_tick_ms);
#endif
last_midi_tick = now;
do_midi_start();
ext_midi_clock_master = false;
do_midi_tick();
}
}
... in thee MIDI-Handler
uint8_t volca_midi_devider = 0;
inline void handleSongPosition( uint pos ){
#ifdef DEBUG_MIDI
DEBUG("MIDI SongPosition ");
DEBUG( pos );
#endif
}
inline void handleClock( ){
#ifdef DEBUG_MIDI
// DEBUG("MIDI Clock ");
#endif
if( midi_playing ){
if( volca_midi_devider==0 ){
set_midi_tick_ms( now - last_midi_tick );
now = millis();
last_midi_tick = now;
do_midi_tick();
}
volca_midi_devider ++;
if( volca_midi_devider >5 ){
volca_midi_devider=0;
}
}
}
inline void handleStart( ){
#ifdef DEBUG_MIDI
DEBUG("MIDI Start ");
#endif
midi_step = -1;
volca_midi_devider=0;
init_midi(); // Acidbanger
}
inline void handleContinue( ){
#ifdef DEBUG_MIDI
DEBUG("MIDI Continue ");
#endif
}
inline void handleStop(){
#ifdef DEBUG_MIDI
DEBUG("MIDI Stop ");
#endif
do_midi_stop();
}
All reactions
Thanks again, @ErichHeinemann , the project lacks enthusiastic people like you!!! I'll incorporate this code soon!
All reactions
Hi, i already modified the code a bit to get a sync to the internal MIDI in Volca-Beats. I am not the "master" of github, I will create a side-project to share the code with You. My Acidbox already sync to TD3 but still 3 x 303 != 909.
Thanks! By the way, 808 actually is a better fit. I've used those 3 roland products together. The 909 bass drum with overdrive is fun though.