Hardware entropy for the voice RNG #12

Closed
opened 2026-08-18 01:34:39 +00:00 by bcox · 0 comments
Owner

Status: considered and rejected. Filed for the record so it is not
re-proposed without the counter-argument.

Raised as: should the voice RNG use real entropy — ring-oscillator TRNGs on the
FPGA, or a CPU cycle counter?

Both were rejected, for the same reason.

Determinism is load-bearing here

.bazelrc forbids FMA contraction and fast-math reassociation specifically so
that a float reference stays a usable oracle for the fixed-point
implementation. Tests assert on concrete rendered audio — the corrupt-preset
test compares a subject instance's energy against a reference instance's, and
the LFO tests pin quarter-cycle values. A nondeterministic source on the
synthesis path would reduce all of that to statistical assertions.

It would also mean a patch sounds different every time it loads, which is
usually a bug report.

The specific mechanisms

  • Ring-oscillator / TERO TRNGs exist on FPGA and are the standard entropy
    primitive, but they would spend fabric on a property this design does not
    want.
  • rdtsc is not synthesisable, so it cannot follow the code to the FPGA
    target at all, and reading it on the audio thread injects nondeterminism into
    the one place the design works hardest to keep deterministic.

What was actually wanted

The problem that prompted it was voices sharing a sequence, not voices being
predictable. That was decorrelation, not entropy, and it is fixed in
6776866.

If across-session variation is ever wanted, see the separate issue on a session
seed chosen at the boundary — entropy outside dsp/, determinism inside.

**Status: considered and rejected. Filed for the record so it is not re-proposed without the counter-argument.** Raised as: should the voice RNG use real entropy — ring-oscillator TRNGs on the FPGA, or a CPU cycle counter? Both were rejected, for the same reason. ## Determinism is load-bearing here `.bazelrc` forbids FMA contraction and fast-math reassociation specifically so that a float reference stays a usable oracle for the fixed-point implementation. Tests assert on concrete rendered audio — the corrupt-preset test compares a subject instance's energy against a reference instance's, and the LFO tests pin quarter-cycle values. A nondeterministic source on the synthesis path would reduce all of that to statistical assertions. It would also mean a patch sounds different every time it loads, which is usually a bug report. ## The specific mechanisms - **Ring-oscillator / TERO TRNGs** exist on FPGA and are the standard entropy primitive, but they would spend fabric on a property this design does not want. - **`rdtsc`** is not synthesisable, so it cannot follow the code to the FPGA target at all, and reading it on the audio thread injects nondeterminism into the one place the design works hardest to keep deterministic. ## What was actually wanted The problem that prompted it was voices *sharing* a sequence, not voices being *predictable*. That was decorrelation, not entropy, and it is fixed in `6776866`. If across-session variation is ever wanted, see the separate issue on a session seed chosen at the boundary — entropy outside `dsp/`, determinism inside.
bcox closed this issue 2026-08-22 19:11:50 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bcox/tymbal#12
No description provided.