Conversation
process() always returned true, so a SoundTouch processor stayed alive for
the life of the AudioContext even after every connection to its node was
gone: it kept rendering and kept its buffers. Apps that create a fresh node
per track (to start from empty FIFOs) accumulated one live processor per
track.
The processor now flips a flag on { type: 'dispose' } and returns false
from the next render quantum, so the browser can release it. SoundTouchNode,
PhaseVocoderNode and FormantCorrectionNode gain dispose(), which posts the
message and disconnects the node.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
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.
An
AudioWorkletProcessoris kept alive for as long as itsprocess()returnstrue, andSoundTouchProcessorBase.process()always did. So once an app disconnects a node and drops it, the processor keeps rendering every quantum and keeps its buffers until theAudioContextcloses. Apps that create a fresh node per track — the way to start a new track from empty FIFOs — accumulate one live processor per track for the life of the context.This adds a
{ type: 'dispose' }port message. The base processor flips a flag on receipt and returnsfalsefrom the next render quantum, so the browser can release it.SoundTouchNode,PhaseVocoderNodeandFormantCorrectionNodegaindispose(), which posts the message and disconnects the node. None of the subclass processors overrideprocess(), so the base change covers all three worklets.DisposeMessagejoins theProcessorMessageunion and is exported from@soundtouchjs/worklet-base.Specs: the base spec covers the flag, the
falsereturn and that the pipe is not touched after disposal; the audio-worklet processor spec drives the real processor through a dispose message; each node spec checks thatdispose()posts the message and disconnects.Docs: the four READMEs list the new message and method.
Noticed but left alone, to keep this to one change: the worklet-base README's runtime-message examples use camelCase names (
setInterpolationStrategy,value) while the processor matches kebab-case (set-interpolation-strategy,strategy/params).Model used: Anthropic Fable 5.1
🤖 Generated with Claude Code