I’ve had an initial foray into updating takt to use the global clock
you can find the code here:
The repository probably needs a better name, since the original script was already at version 2. Suggestions welcome.
Note that if you install this with Takt already installed, you might get a duplicate engine warning.
This is very much alpha stage, so please don’t go removing your old takt install or losing presets etc that you want to keep - maybe just rename the duplicate engine temporarily.
The original code uses metro counters and uses beatclock midi sync. I’ve explored a couple of strategies for switching to global clock, so there are are currently two branches in this repo.
The master branch has my attempt at switching takt away from being based on metros to being based directly on the global clock,.
I’ve got that somewhat working, but there are some issues.
Current issues in master branch:
- unlike the original script, I needed to load the script with the sequencer running
- stop will work once, but won’t restart
- you need to run a command like “sq=clock.run(sequencer)” from maiden to get it starting again
I think this is an issue with how co-routines work, but I’m not sure.
the tempo seems to be too fast - not sure I have the clock.sync argument correct
I’ve left the original tempo setting code for the metro on line 934
The sequencer uses a clock.sync(1/128) which, but I think this is to fast - I started with 1/8 and that was way too slow so I just multiplied up until it seemed about right, but think there are some assumptions in the code that I don’t understand which are throwing things off. In particular, the code in the function seqrun (around lines 530 - 531) might be based on assumptions of a pulses per quarter note setting that I don’t understand.
midi integration is untested
but theoretically, because it is global clock, then it should work, however midi stop and start messages still need to be added
link integration appears to work
I tested this briefly with Ableton - I could vary the speed from ableton and takt would follow suite when the clock was set to link. At the moment, the tempo display doesn’t reflect actual clock tempo when clock is not internal - maybe that value just needs to be updated as part of the redraw loop whenever the clock source is not internal
I’m very much a novice with lua and norns, so I’m sure that there are things I’ve not understood and ways of making the changes cleaner.
On the development branch, I’ve tried a more basic approach of just leaving the metros in place and setting the tempo of the metro from the global clock at the right places and vice versa
This solves the problem of stop and start controls not working. Link tempo changes work well and link stop and start works. Midi sync is still untested.
However the clock drifts after a while - maybe after 16 or 32 bars or I’m not quite sure.
I think that solving the issues in the master branch is probably the way to go rather than trying to fix the sync issues. But there is still other timing issues in the master branch. I will need to explore a bit but if there are smarter heads out there who can spot issues, I’d be much obliged.