SPB Git

Repository Public

back-to-back.md 2.6 KB

# Back To Back

The simplest possible auto-play: whenever the track on one deck ends, the other deck starts and the deck that just ended loads the next track of the Auto DJ queue. No blend, no sync; one track after the other. It runs until you stop it. It shows deck events, a procedure with two deck parameters, and loadNext.

# The script

orixdj
fn handOver(ended: deck, next: deck) {
    next.volume = 0dB
    next.play()
    // The deck that just ended is paused, so it can be reloaded.
    ended.loadNext()
}

automation "Back To Back" {
    on deck.A.trackEnd { handOver(deck.A, deck.B) }
    on deck.B.trackEnd { handOver(deck.B, deck.A) }
    on trigger(16) { stop }
    print("Back To Back is armed. Trigger 16 stops it.")
}

# What happens, bar by bar

Position What happens
Start Three handlers are registered and a message is printed. The automation waits.
Deck A reaches the end of its track Deck B's fader is opened and deck B starts. Deck A, which is now paused, loads the next track of the queue.
Deck B reaches the end of its track The same with the roles exchanged.
Trigger 16 The automation stops. Whatever is playing keeps playing.

# When to use it

For background music, a warm-up, or a break, when tracks should simply follow each other. For beat-matched transitions use Auto DJ or the preset "Auto DJ Blend".

# Check before running it live

  • Deck A is playing; deck B is loaded and cued at its start.
  • The Auto DJ queue contains the tracks to come. When the queue is empty, loadNext() fails and the automation is cancelled with E-ACTION; the deck that just started keeps playing.
  • A control is mapped to automation.trigger.16, or you will stop it with stop "Back To Back".
  • There will be a gap or an overlap depending on how the tracks end and begin: nothing is trimmed or faded.

# Notes and variations

trackEnd fires when the playhead reaches the end of the file. The deck is paused at that point, which is what allows loadNext() on it: loading is refused on a playing deck.

The procedure takes the two decks as parameters, so the two handlers are one line each.

Loading takes a moment. The freshly loaded deck is not started by this script until the other deck ends, so that is not a problem here. If you need to act when a load completes, use the loaded event.

Because the automation has handlers and no once, it never finishes by itself.

Files main
Menu

Theme