Skip to main content

Module envelope

Module envelope 

Source
Expand description

The envelope layer: the amplitude envelope of the notes and the sidechain pump.

The pump comes first: a dip that locks to the beat is stripped from the level tracks before the notes are read. Each note gets an attack, a hold, a decay, a sustain level, a note-off knee, a peak level and a fit of its release and tail. The notes of similar length and register form a pool, and each value of the layer is the median over the pool with its interquartile range. Five votes over the pool read whether the tail is reverb.

Structs§

EnvelopeCounts
How many notes each step read or skipped.
EnvelopeFlags
Flags of the envelope layer.
EnvelopeInput
What the envelope layer reads.
EnvelopeLayer
The envelope layer of a stem.
LevelTrack
A level track in dB, one value per HOP from start.
NoteEnvelope
The envelope of one note.
Pump
The pump read of a stem.
TailFit
The tail model fitted to a note after its note-off.
TailVotes
The votes that a tail is reverb: None when nothing could be read.

Enums§

EnvelopeError
The envelope layer failed.
NoteSkip
Why a note has no envelope.
PumpLock
What a level dip follows.

Constants§

ATTACK_PERIODS_MIN
A rise shorter than this many RMS windows cannot be told from a shorter one: the attack is an upper bound.
ATTACK_TOP
How little the level may rise after the attack’s top.
BAND_STEPS_MIN
The attack of an overlapping note, read on its harmonic band, is an upper bound when its rise is shorter than this many times the band’s rise for an instant step.
BAND_STEP_RISE
The 10-90 % rise of a harmonic band track for an instant step, times its low-pass cutoff: 0.490 to 0.491 at cutoffs of 12 to 40 Hz on a generated 220 Hz sine.
DECAY_FIRST_DB
The first share of the decay lies at least this far below the peak.
DECAY_SHARES
The decay time is read between these shares of the fall in dB from the peak to the sustain level, as the attack is read between 10 % and 90 % of its rise.
DUCK_TAIL_BINS
A duck takes at least this many bins, and DUCK_TAIL_WINDOWS more, from half its depth back to a quarter of it. A read over a grid read of none asks this many bins alone.
DUCK_TAIL_WINDOWS
The shares of the level window that DUCK_TAIL_BINS grows by, for a read that replaces a free read. A read over a grid read of none drops this share, which costs real ducks under a low note.
ENVELOPE_CONVENTION
The convention of the envelope stages in layers.json.
FALL_MAX
A pump falls into its dip within this many bins.
FIT_FLOOR
The tracks are read no lower than this far below the note’s peak, so the floor of a silent frame does not steer a fit.
FLATNESS_RISE
The flatness rises by this much from the note body to the tail.
FOLD_ERROR_GAIN
A fold error must also fall by at least this much, in dB, for the search’s read to replace a read that locks on the grid.
FOLD_ERROR_SHARE
The period search’s read replaces a read that locks on the grid when its fold error is under this share of the grid read’s.
FREE_GAP
A harmonic of an overlapping note is free when it lies at least this far from every harmonic of the notes it overlaps.
FREE_RATE_MIN
The lowest tremolo rate searched.
FREE_REACH
A free line lies within the period search’s reach when it lies this far or nearer from the nearest division.
FREE_RESIDUAL
A tremolo runs free when its rate lies this far from every note division of the tempo.
FREE_SWING
A tremolo counts when its line swings the level by at least this much either way. The slow beating of a chord’s near-coinciding harmonics stays below it.
GAP_LEVEL
A tail outlasts a gap when its level before the next note lies above this level under the sustain level.
HARMONIC_CUTOFF_MAX
The low-pass of a harmonic track sits at most this far from the harmonic. A wider band follows an attack faster.
HARMONIC_CUTOFF_MIN
The low-pass of a harmonic track sits at least this far from the harmonic. A 12 Hz low-pass smears a rise by about 30 ms.
HIGH_BAND_FALL
The share of the bands from 1 kHz falls by this much from the first half of a tail to the second.
HOLD_MIN
A plateau within ATTACK_TOP of the peak counts as hold when it lasts longer than this.
HOP
The hop of every envelope track.
KNEE_BACK
The least ratio of a next note’s held level to the level at the last clear frames.
KNEE_BEND
A later corner replaces an earlier one only when the level between them bends by at most this much.
KNEE_BEND_LAG
The frames each way of the second difference of KNEE_BEND, 10 ms.
KNEE_CONVENTION
The convention of the note-off knee and its offset.
KNEE_END_GAP
The knee search stops this long before the note’s end.
KNEE_FALL
The release side of a knee falls by at least this share of the held level, 6 dB.
KNEE_FLOOR
The release side of a knee ends where the level falls under this share of the held level, -34 dB.
KNEE_GAIN
A two-line fit with a knee removes at least this share of the squared error that one line leaves.
KNEE_LEFT
The held side of a knee spans up to this many frames, 100 ms.
KNEE_RIGHT
The release side of a knee spans up to this many frames, 200 ms.
KNEE_RISE
A later corner replaces an earlier one only when the level after it rises by at most this share of the level before it. A note-off falls for good, and a fade of a reverb comes back.
KNEE_RISE_FRAMES
The frames of the mean that the rise reads past its start, so that a noise floor’s wobble after the note-off does not count as a level that comes back.
KNEE_SIDE_MIN
Each side of a knee spans at least this many frames, 10 ms.
KNEE_STEEPEN
At a knee the slope steepens by at least this share of the held level per second. With KNEE_FALL over KNEE_RIGHT, a linear release shows a knee up to about 400 ms.
LEVEL_SPREAD_CONVENTION
The convention of the level spread.
OBSERVABLE_DECAYS
Decay and sustain are observable when the held part lasts the attack, the hold and this many decay times, or when the note has no knee.
PERIOD_RANGE
The first stage of the period search reads this far either side of the grid’s period, as a share of it; the second reads one step past it.
PERIOD_RUN_BEATS
The period search’s first stage reads at most this many beats of the longest run; the second refines over all counted beats.
PHASE_DEPTH
A beat dips with the curve when its level falls by this share of the curve’s depth: from its highest bin over the FALL_MAX bins before the dip, to its lowest within PHASE_SLACK bins of it.
PHASE_SHARE
The pump locks to the beat when at least this share of the beats dips with the curve.
PHASE_SLACK
A beat dips with the curve when its level falls within this many bins of the curve’s dip.
POOL_LENGTH_FACTOR
The pool holds notes whose length lies within this factor of the median length.
POOL_LEVEL_GATE
The pool leaves out a note whose peak lies this far or more below the peak of a note it overlaps: a quiet second voice, such as another part’s bleed or a ghost note, with an envelope of its own.
POOL_NOTES_MIN
A value over the pool needs this many notes; with fewer it reads low.
POOL_PITCH_RANGE
The pool holds notes within this many semitones of the median pitch.
PROXY_HARMONICS
The amp proxy is the lowest free harmonic up to this one.
PUMP_BACK
The recovery ends where the curve comes back within this much of the reference.
PUMP_BEATS_MIN
The pump needs this many beats that a sustained note covers.
PUMP_BINS
The phase bins of one beat.
PUMP_CONVENTION
The convention of the pump.
PUMP_MIN
A dip at least this deep counts as a pump, and the layer strips it from the envelope tracks.
PUMP_REFERENCE
Each beat’s curve is taken relative to this quantile of its bins, the level between dips.
PUMP_RMS_PERIODS
The RMS window of the pump spans this many periods of the lowest note.
PUMP_STRIP_BEATS
The layer strips a beat-locked pump only over this many counted beats.
RAMP_FACTOR
A linear ramp spends 80 % of its time between 10 % and 90 % of its peak, so the 10-90 % rise times 1.25 is the full attack.
RELATIVE_SPREAD_MAX
Above this interquartile range over the median, a value reads low.
RMS_PERIODS
The RMS window of a note spans this many periods of its fundamental.
RMS_WINDOW_MIN
The RMS window spans at least this long, in whole periods.
SAME_RATE_SPREAD
The tail rate holds over the notes when its interquartile range stays under this share of its median.
SIDE_GROWTH
Side over mid grows by this much from the note body to the tail.
SILENCE_DB
A note whose amp proxy peaks at or below this has nothing to read: a list of notes over a silent stretch would read 0 dB sustains at the tracks’ floor. 16-bit dither sits near -96 dB.
SPREAD_QUANTILES
The level spread is the gap between these quantiles of the full-band levels of the pooled notes.
SUSTAIN_LEAD
A beat counts when one note covers it and started at least this long before it. A pluck struck on the beat then never counts, even when the transcriber places its onset a few milliseconds early.
SUSTAIN_SHARE
The sustain level is the median of this last share of the held part.
TAIL_BAND_PERIODS
The shortest RT60 a band can show is this many periods of its cutoff: a dry chord’s release through a band reads 3 to 5 periods, whatever its length up to 50 ms.
TAIL_CONVENTION
The convention of the tail.
TAIL_FLOOR
The fit reads the tail down to this far under the sustain level.
TAIL_HOLD_BEND
See TAIL_WOBBLE_RESIDUAL.
TAIL_HOLD_FRAMES
The frames before the knee that TailFit::hold_bend reads.
TAIL_HOLD_LAG
The frames each way of TailFit::hold_bend. Slower than the knee’s bend, to see a tremolo under 10 Hz.
TAIL_RELEASE_RANGE
The releases a fit can read, in seconds. A level that never falls would otherwise run the fit to a release of 1e19 s and more.
TAIL_RESIDUAL_MAX
Over this residual the release is not identifiable, and no release is written.
TAIL_RT60_RANGE
The RT60s a fit can read, in seconds.
TAIL_SMOOTH
A tail over TAIL_WEIGHT_MAX that fits within this RMS reads as the note’s own exponential release: a reverb’s level wobbles more.
TAIL_WEIGHT_MAX
Over this tail weight the release is not identifiable, and no release is written.
TAIL_WEIGHT_MIN
A tail lighter than this at the note-off has no RT60 to read: on dry notes the fit often leaves a little weight, and its RT60 is noise.
TAIL_WEIGHT_RANGE
The tail weights a fit can read.
TAIL_WOBBLE_RESIDUAL
A written release reads low when the median residual is over this and the median TailFit::hold_bend over TAIL_HOLD_BEND: a tremolo carries on through the release, which the fit cannot follow.
TRACK_LEAD
The tracks start this long before the onset, so the attack’s start is inside them.

Functions§

amp_proxy
The amp proxy of note against the notes that sound with it, from TRACK_LEAD before its onset to its end, in dB of the harmonic’s power; None when no harmonic is free.
find_knee
The knee of a level track: the split where two lines fit best against one, at the crossing of the left line with the release’s first frames.
fit_tail
Fits the model to db, the level in dB over the sustain level on frames from the note-off. None when too few frames lie above the floor.
full_band_level
The full-band level over a span: the peak of full_band_track; None for a span that holds no frame.
full_band_track
The full-band level track of a span.
lock_name
The name of a lock in the report.
read_note
Reads the envelope of note from the mono mix. others are the notes that sound during it; pump is stripped first when it locks to the beat.
rms_window
The RMS window over periods periods of f0, or the fewest whole periods that span RMS_WINDOW_MIN when that is more.