Repository navigation
Worker kit: parallel audio workers, pausing, and app messages - #11
Merged
Merged
Conversation
…es to and from the page
createAudio().addStream() gives each audio worker its own stream; the worklet
sums them, applies a master gain and a peak limiter. A worker about to be busy
posts {pause: true} so its stream plays as silence instead of counting
dropouts. Python and the page exchange {type: "app"} messages for things only
the page can do (file pickers). The adaptive queue steps down while every
stream's low point stays above 384 frames.
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.
Three additions to
workers/, from using the kit in a real app:createAudio()now returnsaddStream(): give each audio worker its own stream and the worklet sums them, then applies a master gain (setGain) and a peak limiter. Rendering spreads over cores, and the wire protocol per stream is unchanged.{pause: true}on its audio port, and{pause: false}when it's done. The worklet plays that stream as silence meanwhile, instead of counting dropouts and backing off its queue.{type: "app", ...}messages, for things only the page can do, such as the browser's file pickers.handle.send()on the page,js.self.onPageMessagein Python.The adaptive queue now steps down while every stream's low point stays above 384 frames (512 before).
docs/workers.mdcovers all three.