SPB Git

Repository Public

end-of-track-guard.md 3.4 KB 76 lines markdown

1# End Of Track Guard23A safety net for long sets: the automation stays in the background and looks at deck A on every bar. When 32 bars or less remain, it blends to deck B over sixteen bars, if deck B is ready, and then ends. It is event-driven, uses a flag variable, and compares a time in seconds with a length in bars.45## The script67```orixdj8automation "End Of Track Guard" {9    let warning = 32 bars     // how much track must be left when the blend starts10    let blend = 16 bars11    var started = false1213    on bar {14        if not started and deck.A.playing and deck.A.remaining <= warning {15            started = true16            if deck.B.loaded and not deck.B.playing {17                deck.B.sync(true)18                deck.B.volume = -60dB19                deck.B.play()20                over blend {21                    deck.B.volume -> 0dB22                    deck.A.volume -> -60dB23                }24                deck.A.pause()25                deck.A.volume = 0dB26                print("Blend to deck B done.")27            } else {28                print("Deck A is ending and deck B is not ready.")29            }30            stop31        }32    }33}34```3536## What happens, bar by bar3738| Position | What happens |39| --- | --- |40| Start | Three values are set and a `bar` handler is registered. Nothing else happens; the automation stays alive because of the handler. |41| Every bar line | The handler checks: not started yet, deck A playing, and 32 bars or less remaining. Otherwise it does nothing. |42| The first bar line with 32 bars or less left | `started` becomes true, so later bars are ignored. If deck B is loaded and paused: it is synced, silenced and started, and the blend begins. |43| The next 16 bars | Deck B fades in while deck A fades out. |44| 16 bars later | Deck A is paused and its fader restored; a message is printed; `stop` ends the automation. |45| If deck B was not ready | A message is printed and the automation stops at once. |4647## When to use it4849When you may be away from the decks, or as a backstop while you prepare something else. Start it once deck A is playing and deck B is loaded.5051## Check before running it live5253- Deck B is loaded, paused and cued where it should start, with its EQ and filter as you want them.54- Both tracks have an analysed tempo.55- Deck A's track is longer than the warning distance, and it is the track you expect to end.56- No other automation is going to move the faders of decks A and B.57- You know it is running: `status` lists it. Stop it with `stop "End Of Track Guard"` if you decide to mix by hand.5859## Notes and variations6061`deck.A.remaining <= warning` compares seconds with bars. Both are converted to beats with the tempo of the master clock at that moment, so the test means "32 bars of the current tempo".6263The handler takes sixteen bars while its event fires every bar. The `started` flag is what prevents a second run from starting a second blend; without it there would be one more run per bar.6465The blend lands on a bar line because `bar` events fire on bar lines. It does not know about phrases: choose `warning` and the cue point of deck B so that the entry makes musical sense.6667The automation stops after one transition. To keep guarding, start it again when the next track is loaded, or see [Back To Back](back-to-back.md).6869## Related7071- [Events](../events.md)72- [Conditions](../conditions.md)73- [Automation Scheduling](../scheduling.md)74- [Console Usage](../console.md)75- [Examples](README.md)76
Files main
Menu

Theme