Hey,
Do you think E1 could become a very precise (like a dedicated hardware clock) midi clock (master) and send the clock via midi and usb?
Cheers
Hey,
Do you think E1 could become a very precise (like a dedicated hardware clock) midi clock (master) and send the clock via midi and usb?
Cheers
My guess would be no (for a lot of reasons I can probably list), but only Martin knows for sure.
In the process of developing a few sequencers for the E1 I have found using external clock seems more stable than relying on the E1s internal clock. I asked the AI assistant if I was imagining it. Here is what it said:
Based on the firmware’s own documented behaviour, I’d expect external clock to be the more reliable of the two for this style of preset, and your observation (glitching on internal clock around a page change) fits a known failure mode exactly.
The reason: when the preset generates its own clock, this sequencer’s stepping is driven by timer.onTick() on the application thread — the same thread that does every repaint, including a page switch. The reference is explicit about what happens when that thread falls behind: a tick that is “a whole period or more behind” is skipped outright — not delayed, not queued, gone — and timer.getSkippedTicks() is the only record of it. A page change does a burst of redraw work on exactly that thread, so it’s a very plausible trigger: a skipped tick there is a permanently lost pulse, which is a small, un-recoverable glitch every time it happens — matching what you’re seeing.
Following an external clock instead, each incoming clock byte is delivered to that same thread through a queue rather than a timer schedule. A brief stall (one page redraw) just delays delivery slightly and the design already copes with that correctly — tickSequencer explicitly walks through any steps that came due while it catches up, and nothing is lost unless the stall is long enough to fill the delivery queue outright (midi.getDroppedCallbacks()), which is a much higher bar than missing one timer period. So external clock is structurally more forgiving of exactly the kind of momentary interaction (a page switch) you describe, though sustained heavy interaction (the DIVISION-sweep case) can still eventually cost it a pulse too.
just a quick response: timer runs on the application thread may experience delays. Timer is there for two reasons and should be used for activities that may experience a jitter and for backwards compatibility. Look at transport clock related functions and midi event scheduling (at function). These are designed for precise clock/midi and run on the midi thread (highest priority). In other words, you should decouple UI from the MIDI messaging.
EDIT: I will make this more obvious in the docs and the AI reference files.
Thanks Martin. This is the prompt I asked AI to produce so I can make sure the clocking features are correct in my presets. In case it is useful to anyone:
This preset may be driving its own step sequence (arp, sequencer, gate pattern, etc.) from timer.onTick() on the application thread, and may be sending each step’s note-on synchronously from inside that callback rather than scheduling it precisely. The firmware developer confirmed: timer runs on the application thread and may experience delays — fine for things that can tolerate jitter, but not for precise output. transport.* (the clock generator) and midi.at() run against the MIDI schedule thread and are the precise path; the fix is to decouple step triggering from the actual MIDI send.
Please:
Read the stepping engine (wherever timer.onTick, timer.setPeriod, and the function that actually calls midi.sendNoteOn/sendNoteOff for a step live).
Check whether every note-on is scheduled via midi.at() against a precise, independently-advancing target time — not sent bare, and not scheduled against schedule.now() + delay computed inside a possibly-late tick.
If it isn’t, implement a lookahead scheduler for the Internal-clock path: poll on a fixed, fast timer period (start around 20-30ms — tune down if the device log shows “timer.onTick … is in trouble”; the reference’s own guidance is “33 to 50 a second is comfortable”), maintain a nextDueAt grid advanced by the real step period each step, and fire a step only once it’s within a small lookahead margin of due, sending its note through midi.at(dueAt).
Keep the existing “silently catch up without bursting notes” behaviour for a genuine stall (more than one period behind).
Watch for float/int mismatches: timer.setPeriod/schedule.now()-derived values must stay integers end to end, or midi.at()/schedule.after() will raise “number has no integer representation.”
Preserve any debug/test helper that manually steps the sequence (e.g. a debugTick()-style backdoor) by having it force a step unconditionally, bypassing the new real-time gate — so manual probing and any test-suite calls into timer.onTick() directly keep working the same way they did before.
Leave clock-OUT generation (transport.enableClock/startClock/setClockOutputs) and any existing Swing/Groove/Strum-style midi.at() delays alone if they’re already scheduling correctly — only the step engine’s own trigger-to-send path needs this.
Upload, read the device log (ignore anything that’s just your own print output — the log reader flags lines containing “err”/“fail” as substrings, even in your own variable names), and verify over real elapsed wall-clock time (not synchronous test calls) that holding a note for several seconds produces the mathematically expected note count at the set tempo.