Skip to content

reverb, loudness: memoize - #150

Open
passyur wants to merge 4 commits into
mainfrom
claude/tender-mirzakhani-1af1a7
Open

reverb, loudness: memoize#150
passyur wants to merge 4 commits into
mainfrom
claude/tender-mirzakhani-1af1a7

Conversation

@passyur

@passyur passyur commented Jul 28, 2026

Copy link
Copy Markdown
Member

Two optimizations to loudness in addition to changes in #103 that I'll just copy the text of here:

for each note, every partial was being expanded into numChannels full-length buffers during spatialize_Track. for the default spatializer, each of those buffers were identical copies scaled by 1/numChannels. this change leverages the fact that these buffers are copies of an initial buffer by performing the per-partial spatialization computation outside of the per-sound loop (and during the unification step).

These are pretty lucrative changes, as they remove a bunch of redundant allocs that ran in the Loudness::calculate loop by memoizing RELATIVE_AMPLITUDE per partial and calculating LOUDNESS once (as it's constant). Also removes a pointless copy-and-replace of the percentReverbinput argument. Finally, Envelope::getValue now has a fast path for linear segments.

passyur added 4 commits June 18, 2026 13:53
for each note, every partial was being expanded into `numChannels` full-length buffers during `spatialize_Track`. for the default spatializer, each of those buffers were identical copies scaled by `1/numChannels`. this change leverages the fact that these buffers are copies of an initial buffer by performing the per-partial spatialization computation outside of the per-sound loop (and during the unification step)
instead of repeatedly allocating new vectors, store vectors as members for each Reverb computation and reuse existing vectors (after zeroing)
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