Repository navigation
Crest factor: 0 instead of NaN on silence - #46
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cfdivides the window's peak by its RMS with no guard. On silence both are 0, the result is NaN, and the NaN rides throughzerr.envelopes~/zerr.combinator~/zerr.disperser~(Max) and the Pd chain alike until the input comes back. Found while writing thezerr.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.abson a double becamestd::fabs.User-visible effect (rule 7)
zerr.features~ cfoutputs 0 on silence instead of NaN. Line added todocs/releases/max-v0.3.0.md.zerr_features~ cflikewise. Line added todocs/releases/pd-next.md.Verified with a syntax-only compile of the file; the feature has no test. Listening check: feed
zerr.features~ cfsilence, then a sine; the outlet must read 0 and then about 1.41, never NaN.🤖 Generated with Claude Code