audioeffects.expander

Expander - a downward expander in the Drawmer DS201’s shape.

The player’s text is the class docstring; the CLAIMS table in the class’s test file ties its claim sentences to tests.

audioeffects.expander.KEY_RING_CYCLES = 2.65

How long a two-pole key filter takes to ring from near full scale to under half an LSB, in units of 1 / fc seconds: ln(65536 * 2) time constants of 0.225 / fc each.

class audioeffects.expander.Expander(source, *options, **keywords)[source]

Bases: Component

A downward expander in the Drawmer DS201’s shape: below the threshold, quiet passages get quieter, by a ratio you set and down to a floor you set, without the slam of a gate. Above the threshold it is a wire.

Controls. Threshold is where the expansion starts. Ratio is how many dB the output falls for every dB the input falls below the threshold; with the RMS detector the slope stays within 5 % of it even at 8. Depth is the floor: a quiet passage falls no further than that, to within 0.5 dB. Ratio 1 and Depth 0 are each a wire, byte for byte. Attack and Release set how fast the detector follows the level. The Effect controls page lists what the knobs span.

The key. Key Low and Key High, the top just under Nyquist, narrow the band the detector hears, at 12 dB/octave at each end, so a loud tone outside the band can still open it. Key Listen puts that band on the output so you can hear what the detector hears. Pass key= another stream and the detector reads that instead of your signal, the DS201’s external key.

Detector. RMS, the default, gives a sine and a square of equal RMS the same gain, to within 0.1 dB at Ratio 2 with the band wide open. Peak rides each cycle of the waveform, so the slope falls short of the ratio and the expander turns into a soft, slightly gritty gate; the Hard Downward patch is built on it.

No hold. There is no Hold and no one-shot envelope: the expander follows the level continuously. For a gate with a trigger, use NoiseGate.

Timing. Latency is zero at every setting. So is the tail, except with Key Listen on, when the key filters ring on after your signal stops: tail_samples bounds that ring, under 6000 frames at 48 kHz.

On a board. The class needs audiodsp’s audiodynamics, and on a board without it construction raises ImportError.

NAME = 'Expander'

The stable provider name audioeffects.create() discovers.

TIER = 'audiodsp'

STOCK or AUDIODSP, with REQUIRES naming the audiodsp-own modules an AUDIODSP class needs.

Type:

roadmap §3

CAPABILITIES = ()

Nothing in an expander’s law refers to tempo, and neither source’s unit has a tempo input (dossier App. I, D10). The transport is never read, so nothing is declared.

LATENCY_SAMPLES = 0

the gain lands on the frame the detector read. Measured by CLICK at 48 kHz and 44.1 kHz.

Type:

No look-ahead, no delay line

TAIL_SAMPLES = 0

The VCA is a per-sample multiply on the audio, so silence in is exactly zero out in the same frame however the envelope stands. The Key Listen diagnostic is the one path with memory of its own, it is off in every patch, and tail_samples bounds its ring while it is on.

MACRO_LABELS = ('Threshold', 'Ratio', 'Depth', 'Attack', 'Release', 'Key Low', 'Key High', 'Key Listen', 'Detector')

Knob names, one per macro index; one mode per label; the private engineering spans behind them; and the patches on the 0-127 grid.

PATCHES = {0: ('Gentle Lift', (70, 25, 32, 69, 77, 0, 127, 0, 127)), 1: ('Noise Floor Trim', (40, 56, 48, 58, 84, 0, 127, 0, 127)), 2: ('Snare Tighten', (87, 109, 40, 43, 62, 45, 89, 0, 127)), 3: ('Guitar Amp Hum', (56, 85, 64, 69, 81, 62, 71, 0, 127)), 4: ('Room Reduction', (71, 67, 24, 78, 100, 0, 127, 0, 127)), 5: ('Hard Downward', (79, 127, 95, 51, 68, 0, 127, 0, 0)), 6: ('Expander - lean', (70, 25, 32, 69, 77, 0, 127, 0, 0))}

Patch 0 is the constructor’s own defaults on the 0-127 grid.

property tail_samples

0, or with Key Listen on a bound on the key filters’ ring.

Each key filter is a two-pole section. From a state near full scale it is under half an LSB after about KEY_RING_CYCLES / fc seconds, and the two add, so the bound is the sum at Key Low and Key High as they stand.

gain_reduction_db()[source]

What the gain computer applied on the last frame rendered, in dB.

The node’s own readout, forwarded. Not part of the component contract - a meter, and the measurement kit’s GAINTRACE source.