Skip to content

unison: a cluster's copies fan over the wavetable (frame_spread) - #1259

Open
rt-rtos wants to merge 1 commit into
shorepine:mainfrom
rt-rtos:feat/unison-frame-spread
Open

rt-rtos wants to merge 1 commit into
shorepine:mainfrom
rt-rtos:feat/unison-frame-spread

Conversation

@rt-rtos

@rt-rtos rt-rtos commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

unison: a cluster's copies fan over the wavetable (frame_spread)

Split out of #1251, where this was the second commit, so the wavetable rungs there can be reviewed on their own. One commit on main.

Summary

A detuned wavetable cluster whose copies all read the same frame sounds like one voice through a chorus. With each copy reading its own part of the table the stack turns into several related voices, and when the frame moves, each copy morphs at its own point. The idea is the frame spread of Vital's unison, with the fan centred on the osc's frame where Vital's runs one-sided from it by detune, so the frame position keeps meaning the centre of the sound when a scan moves it.

frame_spread is a tenth value of C (0-1, default 0) for WAVETABLE: the copies of a group fan over that fraction of the table around the osc's own position. docs/synth.md on the branch carries the semantics.

01-frame-spread-demo.mp4

BRAIDS01, then PPG_WA00, each at frame_spread 0, 0.3 and 0.6. Four oscs hold two chords below middle C, four copies each over +/-12 cents, no filter, and EG0 sweeps the frame from 0.2 to 0.55 over every note.

Context

  • The cycle pair and the two weights are picked per copy instead of once per osc: about ten float operations per copy per block, nothing per sample, no new table, no new buffer. A plain wavetable osc runs the loop once, as before.
  • unison_copy carries the copy's place in its group, set in unison_prepare; the other renderers ignore it. The Python unison keyword is a list, so the tenth value passes through unchanged.
  • A fan that would pass an end of the table shrinks rather than clamps each copy, which keeps the osc's position the centre; the per-copy clamp had piled every copy past the edge onto the end frame whenever a scan carried the fan there.
  • The fan is per group, as the detune spread is, so every group reads the same frames. A group of one copy therefore stays on the osc's frame, and a cluster split over a stereo pair needs four copies per group before both oscs fan.

Verification

  • With no frame_spread sent the render is byte-identical to main: a four-copy cluster in two groups with the frame swept, and a plain wavetable note (host, fixed point).
  • tests/test_unison: clusters at frame_spread against plain oscs at the fanned positions, -54 to -70 dB over five cases, both ends of the shrink among them; the field inert on a saw cluster and on a single wavetable copy; clamp, read-back and wire form. The existing cases pass unchanged.

Notes for reviewers

  • UNISON_FRAME_SPREAD is appended before NO_PARAM, so no existing param id moves. That puts it after UNISON_RANDOM, outside the range in play_delta that claims the unison union and respreads phases: a frame_spread alone makes no cluster and moves no phase.
  • The per-copy clamp left in the fan is against rounding (pos at the outer copy can land an ulp outside) and keeps the crossfade in 0..1.
  • wavetable: band-limited rungs by pitch, #1251 edits the same loop in render_wavetable. Whichever of the two merges second, I rebase it over the other; the test of a fanned cluster reading from a rung comes with that one.

A tenth unison value, frame_spread (0-1, default 0), for WAVETABLE: the
copies of a group read their own parts of the table, fanned over that
fraction of it around the osc's own position, copy j of m at
(j / (m - 1) - 0.5) of the fan. A fan that would reach past either end
of the table shrinks to the room on that side, so the copies stay
evenly spaced around the osc's position and the width follows the room;
at the very end every copy reads the end frame. Every group fans the
same way, and the osc's position still follows duty and its
modulation, so a scan moves the whole fan. A detuned cluster whose
copies also differ in spectrum reads as one wide, moving sound rather
than a chorused single one; it is the "frame spread" of Vital's
wavetable unison.

render_wavetable() already renders each copy as two table passes with
the crossfade as gains; it now picks each copy's cycle pair and weights
from the copy's own position instead of once per block, so a copy costs
what it did. unison_copy carries the copy's place in its group, set in
unison_prepare(). Other waves ignore the field. Parsed, printed, unset,
clamped, read back and MIDI-mappable like the other nine values; the
generated JS constants follow.

tests/test_unison: a two-copy wavetable cluster at 0.4 against two plain
wavetable oscs at duty 0.3 and 0.7 (-68 dB), the same with two octave
groups against four plain oscs (-62 dB), the shrink at both ends (duty
0.1 against plain oscs at 0 and 0.2, duty 0.9 against 0.8 and 1, four
copies at duty 1 against four plain oscs at the last frame), the field
inert on a saw cluster and on one wavetable copy, the clamp, read-back
and wire form.

This branch has not been deployed

No deployments
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