SPB Git

Repository Public

tempo-shift.md 2.8 KB

# Tempo Shift

Changes 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.

# The script

orixdj
automation "Tempo Shift" quantize bar {
    let goal = 124            // target tempo in BPM
    let length = 16 bars

    if deck.A.trackBpm == 0 {
        print("Deck A has no analysed tempo.")
        stop
    }
    if master.deck != "A" {
        print("Deck A is not the master deck.")
        stop
    }

    let before = deck.A.bpm
    deck.A.keylock = true
    over length curve smooth { deck.A.bpm -> goal }
    deck.A.bpm = goal
    print("tempo moved from", before, "to", goal, "BPM")
}

# What happens, bar by bar

Position What happens
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.
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.
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.
Bar 17, beat 1 The tempo is set to exactly 124, and the script prints the old and new tempo. The automation finishes.

# When to use it

To 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.

# Check before running it live

  • Deck A is playing, has an analysed tempo, and is the deck driving the master clock (master.deck is A).
  • 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.
  • The target is within reach: the playback rate is limited to 0.5…2 times the original tempo.
  • Any other playing deck has sync on if it should follow.

# Notes and variations

The 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.

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.

Key lock is left on. Remove the deck.A.keylock = true line for a vinyl-style pitch change.

The 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.

Files main
Menu

Theme