Skip to content

Crest factor: 0 instead of NaN on silence - #46

Merged
zeyuyang42 merged 1 commit into
mainfrom
crest-factor-silence
Oct 16, 2026
Merged

zeyuyang42 merged 1 commit into
mainfrom
crest-factor-silence

Conversation

@zeyuyang42

Copy link
Copy Markdown
Collaborator

cf divides the window's peak by its RMS with no guard. On silence both are 0, the result is NaN, and the NaN rides through zerr.envelopes~ / zerr.combinator~ / zerr.disperser~ (Max) and the Pd chain alike until the input comes back. Found while writing the zerr.features~ help patch.

Change: crr_y = square_root > 0.0 ? peak_max / square_root : 0.0;, which is what the spectral features do with no energy. abs on a double became std::fabs.

User-visible effect (rule 7)

  • Max: zerr.features~ cf outputs 0 on silence instead of NaN. Line added to docs/releases/max-v0.3.0.md.
  • Pd: zerr_features~ cf likewise. Line added to docs/releases/pd-next.md.

Verified with a syntax-only compile of the file; the feature has no test. Listening check: feed zerr.features~ cf silence, then a sine; the outlet must read 0 and then about 1.41, never NaN.

🤖 Generated with Claude Code

peak / RMS with both at 0 is NaN, and the NaN rode into every object
downstream once the input went quiet. Report 0 like the spectral
features do with no energy. std::fabs instead of abs on a double.

Max: zerr.features~ cf no longer poisons zerr.envelopes~ on silence.
Pd: zerr_features~ cf, same. Notes added to max-v0.3.0.md and pd-next.md.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@zeyuyang42
zeyuyang42 merged commit 7fb0d06 into main Oct 16, 2026
8 checks passed
@zeyuyang42
zeyuyang42 deleted the crest-factor-silence branch October 16, 2026 23:33
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