Skip to content

LFO module fixes - #51

Merged
danigb merged 9 commits into
mainfrom
lfo
Sep 7, 2026
Merged

danigb merged 9 commits into
mainfrom
lfo

Conversation

@danigb

@danigb danigb commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Made with Claude

Every continuous shape now crosses zero going up at phase 0, and ExpTriangle
agrees with Triangle about which half of the cycle is the peak. dsp.ts carries
the shape table as a specification; dsp.test.ts asserts every row of it.

Ticket: thoughts/tickets/lfo/02-assert-the-shapes-numerically.md
RandSampleHold and Impulse were module-scope singletons shared by every Lfo in
an AudioContext: a fresh Impulse node emitted nothing, and a fresh
sample-and-hold opened on another instance's value. createGenerators() builds
them per instance, and dsp.test.ts asserts the independence the package used to
document as a limitation.

Ticket: thoughts/tickets/lfo/01-independent-generator-state.md
gain and offset widen to the [-20000, 20000] that ad, adsr and param already
declare for the same x * gain + offset. descriptors.test.ts now pins the four
together, and dsp.test.ts asserts that a negative gain is an exact negation.

Ticket: thoughts/tickets/lfo/03-a-depth-that-inverts.md
An a-rate sync param whose rising edge restarts the phase, a phase construction
option taking a number or "random", and a bipolar frequency. One parameter and
one option deliver per-note retrigger, phase offset, decorrelated stacked LFOs
and tempo sync, because a node into an a-rate param is the library's only sync
mechanism and it already reaches everything.

lfo joins the _gate.ts copy list as its first modulation source.

Ticket: thoughts/tickets/lfo/04-start-the-lfo.md
gate, delay and attack: hold at zero depth, one-pole ramp to full, then stay.
A rising gate restarts the fade, a falling one freezes it, and the defaults mean
no envelope at all so every existing patch is bit-identical.

This discharges the Juno-6 LFO requirement and replaces MonoSynth's gain: 0
external fake with a real vibrato.

Ticket: thoughts/tickets/lfo/05-delay-and-ramp-to-depth.md
frequency becomes a-rate, read with the hoisted length > 1 idiom so an
unmodulated rate is bit-identical and free, and a modulated one costs 2.3-9.4%.
The 200 Hz ceiling stays and is documented: the aliasing table is now a test.

Ticket: thoughts/tickets/lfo/06-a-rate-that-moves.md
RandSmooth (11) and Drift (12), appended: one random target per cycle faded with
Perlin's quintic, and two octaves of gradient noise along the phase. Measured,
100% of RandSmooth's local extrema fall on a cycle boundary against 0.7% of
Drift's - one has a beat and the other does not, which is why both exist.

Drift's lacunarity is the golden ratio rather than 2, because gradient noise is
zero at every lattice point and an integer lacunarity would leave an audible
period in the shape whose job is not to have one.

Ticket: thoughts/tickets/lfo/07-a-random-that-glides.md
LfoExample draws the LFO's own output on a scope - the shape gallery, vibrato,
delayed vibrato and tempo sync - and LfoStackExample shows two 0.3 Hz LFOs with
and without phase: "random". The docs page is rebuilt on adsr.mdx's shape, with
a Behaviour section and callouts.

docs.test.ts is the assertion that the Problem cannot recur: the README's and the
page's parameter tables must name exactly the parameters that exist, with their
declared ranges and rates. It immediately found two tickets' worth of rows that a
string replacement had silently dropped after prettier realigned a table.

Ticket: thoughts/tickets/lfo/08-the-lfo-gets-a-page.md
@danigb
danigb merged commit e243209 into main Sep 7, 2026
1 check passed
@danigb
danigb deleted the lfo branch September 7, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant