subsequence.link_clock¶
Ableton Link clock adapter for Subsequence.
Wraps aalink.Link and adapts its asyncio-native API to Subsequence’s
24 PPQN pulse model. Requires the optional link extra:
pip install subsequence[link]
Usage:
link_clock = LinkClock(bpm=120, quantum=4.0, loop=asyncio.get_running_loop())
beat_origin = await link_clock.wait_for_bar()
# ... in the pulse loop:
await link_clock.sync(beat_origin + pulse_count / PPQN)
Module Contents¶
- class subsequence.link_clock.LinkClock(bpm: float, quantum: float, loop: asyncio.AbstractEventLoop)[source]¶
Thin wrapper around
aalink.Linkfor Subsequence’s pulse-based clock.- Parameters:
bpm – Initial tempo in BPM (proposed to the Link session).
quantum – Beat cycle length — 4.0 means one bar in 4/4 time.
loop – The running asyncio event loop (required by aalink).
Join the Link session immediately, proposing bpm and setting the bar length to quantum beats.
- request_tempo(bpm: float) None[source]¶
Propose a new tempo to the Link session.
Other peers may accept or reject the change depending on their own session rules. Subsequence’s sequencer will pick up the network- authoritative tempo on the next pulse.
- async sync(beat: float) float[source]¶
Wait until the Link session beat reaches beat, then return beat.
This is the primary timing primitive used by the sequencer loop. Calling
await link_clock.sync(beat_origin + pulse / PPQN)for each successive pulse gives accurate, Link-synchronised timing.