SPB Git

Repository Public

tempo-shift.md 2.8 KB 66 lines markdown

1# Tempo Shift23Changes the tempo of the set gradually: the tempo of deck A moves from its current value to 124 BPM over sixteen bars. Deck A must be the master deck, so the master clock, and every synced deck, follows. The script reads live values, checks two preconditions, and ramps a deck's `bpm`.45## The script67```orixdj8automation "Tempo Shift" quantize bar {9    let goal = 124            // target tempo in BPM10    let length = 16 bars1112    if deck.A.trackBpm == 0 {13        print("Deck A has no analysed tempo.")14        stop15    }16    if master.deck != "A" {17        print("Deck A is not the master deck.")18        stop19    }2021    let before = deck.A.bpm22    deck.A.keylock = true23    over length curve smooth { deck.A.bpm -> goal }24    deck.A.bpm = goal25    print("tempo moved from", before, "to", goal, "BPM")26}27```2829## What happens, bar by bar3031| Position | What happens |32| --- | --- |33| Before bar 1 | The automation waits for the next bar line. It stops with a message if deck A has no analysed tempo or is not the master deck. |34| Bar 1, beat 1 | The current tempo is remembered for the final message. Key lock is switched on so that the pitch does not change with the tempo. |35| Bars 1 to 16 | The tempo of deck A glides to 124 BPM with the `smooth` curve: slow at both ends, faster in the middle. |36| Bar 17, beat 1 | The tempo is set to exactly 124, and the script prints the old and new tempo. The automation finishes. |3738## When to use it3940To bring the tempo down or up across a long section so that the next track can be mixed at its own tempo, or to move between genres. Sixteen bars for four BPM is slow enough to go unnoticed.4142## Check before running it live4344- Deck A is playing, has an analysed tempo, and is the deck driving the master clock (`master.deck` is `A`).45- Deck A is not itself synced to another deck: a synced deck is steered by the clock and a tempo ramp on it would be overwritten.46- The target is within reach: the playback rate is limited to 0.5…2 times the original tempo.47- Any other playing deck has `sync` on if it should follow.4849## Notes and variations5051The bars of this automation are bars of the master clock, and the clock follows deck A. As the tempo changes, the bars change length with it: the ramp lasts sixteen bars of music, not a fixed number of seconds.5253`master.bpm` cannot be ramped, and writing it has no effect while a deck drives the clock. Ramping `deck.A.bpm` is the way to move the tempo of a playing set.5455Key lock is left on. Remove the `deck.A.keylock = true` line for a vinyl-style pitch change.5657The final `deck.A.bpm = goal` is not required, since the ramp ends exactly on its target; it is kept to make the end state obvious to a reader.5859## Related6061- [Beats and Bars](../beats-and-bars.md)62- [Automation Scheduling](../scheduling.md)63- [Conditions](../conditions.md)64- [Deck Commands](../deck-api.md)65- [Examples](README.md)66
Files main
Menu

Theme