Repository navigation
feat: add native Float32 APIs and AudioWorklet module - #71
Closed
google-labs-stitch[bot] wants to merge 5 commits into
Closed
google-labs-stitch[bot] wants to merge 5 commits into
google-labs-stitch[bot] wants to merge 5 commits into
Conversation
- Add interleaved, planar and mono f32 process methods. - Add interleaved, planar and mono f32 drain methods. - Map NaN to zero and clamp f32 inputs to -1.0..=1.0. - Scale rendered PCM samples by 1/32768 and zero unused drain frames. - Preserve the fixed-point chain and i16 PCM output.
- Preallocate reusable Vec<f32> buffers in WasmProcessor. - Add processF32, processMonoF32, drainF32 and drainMonoF32. - Validate lengths, block limits and events before state changes.
- Export loadTuneletModule from the package entry point. - Reject loadTunelet without a source in AudioWorkletGlobalScope. - Add UTF-8 text codecs for AudioWorkletGlobalScope. - Add TuneletWorkletProcessor with initSync and MessagePort controls. - Add TuneletWorkletNode and createTuneletWorkletNode. - Export the ./worklet and ./worklet-processor subpaths. - Document the Float32 APIs, AudioWorklet and glue limits.
- Use process_into and downmix in the f32 processor methods - Use check_block in the Float32Array Wasm methods - Initialize Node.js file URLs with init in src/index.ts - Add the AudioWorklet files and subpaths to scripts/verify-pack.mjs
- Keep the Float32Array Wasm doc comments in src/wasm.rs - Keep the AudioWorklet subpaths and check:wasm in package.json - Keep the AudioWorklet documentation and check:wasm in README.md
Contributor
|
Closing as superseded by #84 and #117 for Float32 audio primitives. The bundled AudioWorklet module has several bugs: it hard-cuts reverb/choir tails when input disconnects, statically imports worklet-processor.js into the main-thread bundle, lacks a ready handshake, and delays drain completion by an extra quantum on exact multiples. |
byteland-app
deleted the
stitch/add-float32-and-audioworklet-jm1-06c86307-3064-4f25-b445-6bd9636d3920
branch
November 25, 2026 08:05
Contributor
Author
|
Understood — leaving this PR closed in favor of #84 and #117, and pushed fixes for all reported items onto
|
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.
Summary
process_f32,drain_f32), planar stereo (process_planar_f32,drain_planar_f32) and mono (process_mono_in_place_f32,drain_mono_f32)f32audio methods toProcessorinsrc/processor.rs, preserving the Q14/Q8 fixed-point DSP chain and zero post-construction heap allocations.NaNf32input samples to0, clamp values to-1.0..=1.0, quantize deterministically intoi16, scale renderedi16samples by1.0 / 32768.0and fill unusedf32drain frames with0.0.processF32,processMonoF32,drainF32anddrainMonoF32toTuneletinsrc/wasm.rsbacked by preallocatedVec<f32>buffers.loadTuneletModule(source?)fromsrc/index.ts, rejectloadTunelet()/loadTuneletModule()without a source insideAudioWorkletGlobalScope, and supply UTF-8TextDecoder/TextEncodersupport forAudioWorkletGlobalScopeinsrc/text-codec.ts../worklet(createTuneletWorkletNode,TuneletWorkletNode) and./worklet-processor(TuneletWorkletProcessor,"tunelet-processor") subpaths with upfront 44.1 kHz / 48 kHz validation, synchronousinitSyncinitialization, chunkedmaxBlockFramesrendering, mono/stereo/disconnected input handling andMessagePortcontrols.package.json,tsconfig.jsonandREADME.mdwith zero runtime npm dependencies and document the JavaScript glue allocation limits.Verification
Processor(i16stereo and mono) andTunelet(Int16Array).f32& zero-allocation checks: Verified zero heap allocations afterProcessor::newwith a countingGlobalAlloc, exact round-trip equivalence across all 65,536i16values scaled by1.0 / 32768.0,NaN/±Infinity/out-of-range clamping,0.0drain zero-fill and preflight error invariants.AudioWorkletchecks: Verified subpath exports,loadTuneletModulecompilation, upfront unsupportedsampleRaterejection, 44.1 kHz & 48 kHz mono/stereo/disconnectedAudioWorkletrendering,maxBlockFrames = 64chunking,MessagePortcontrols and zerofetch()calls inAudioWorkletGlobalScope.cargo build --locked --release,cargo fmt --check,cargo clippy --locked --lib -- -D warnings,cargo doc --locked --no-depsandnpm run buildpass with zero warnings.Automated PR initiated by user @byteland-app via Stitch Loop.