Repository Public
1# Sidechain Pump23Imitates the pumping of a sidechain compressor with the channel fader: on every beat the level of deck A drops by 9 dB and recovers over three quarters of a beat. It shows `every` with a ramp in its body, gain arithmetic, and `bars(…)` to build a duration from a number.45## The script67```orixdj8automation "Sidechain Pump" quantize bar {9 let depth = -9dB // how far the level ducks on each beat10 let barCount = 8 // how long the pump lasts1112 let rest = deck.A.volume // the level to come back to13 every 1 beat for bars(barCount) {14 deck.A.volume = max(rest + depth, -60dB)15 over 3/4beat curve easeOut { deck.A.volume -> rest }16 }17 deck.A.volume = rest18}19```2021## What happens, bar by bar2223| Position | What happens |24| --- | --- |25| Before bar 1 | The automation waits for the next bar line. |26| Bar 1, beat 1 | The current fader level of deck A is remembered as the level to return to. |27| Every beat, for eight bars | The fader drops to 9 dB below that level, then rises back with an `easeOut` curve over three quarters of a beat, and rests for the last quarter. |28| Bar 9, beat 1 | The fader is set to the remembered level. The automation finishes. |2930## When to use it3132On a sustained layer (pads, an acapella, a long breakdown) to give it movement in time with the kick of another deck. On a track with its own kick it weakens every beat, which is rarely what you want.3334## Check before running it live3536- The deck to pump is playing; change `deck.A` to the deck that carries the layer.37- Its fader is where you want the top of the pump to be.38- The master clock is driven by the track that has the kick, so that the ducks fall on the beats.39- Nothing else is moving that fader.4041## Notes and variations4243`rest + depth` adds two gains: with the fader at 0 dB and a depth of -9 dB the duck goes to -9 dB. `max(…, -60dB)` keeps the result inside the fader's range when the fader is already low.4445The body of `every` takes three quarters of a beat, less than the period of one beat, so each turn starts exactly on the grid. If the ramp were as long as the period or longer, turns would start late; see [Loops](../loops.md).4647Each beat costs one write and one ramp: 32 writes in eight bars. Ramp updates are not counted in the command limit.4849For a deeper or shallower pump change `depth`; for a longer recovery use `7/8beat`; for a pump on the off-beat, add `wait 1/2beat` before the `every` loop.5051## Related5253- [Loops](../loops.md)54- [Timing](../timing.md)55- [Types](../types.md)56- [Performance Guidelines](../performance.md)57- [Examples](README.md)58