Repository navigation
Add bounded FLAC Wasm encoding and async streaming decoding - #2
Merged
Merged
Conversation
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.
Adds
@misofm/codecwith incremental FLAC encoding and asynchronous streaming decoding, built with Bun and Effect v4 around pinned libFLAC 1.5.0 Wasm. The decoder emits metadata, bounded packed PCM, and a verified completion event, providing the codec boundary needed for a later engine-web-adapter migration.Encoding uses level 8 without exhaustive model search and a caller-owned random-access sink. Decoding suspends for asynchronous input within a frame, observes downstream backpressure, and uses fixed 2 MiB Wasm memory. Portable assets and Node/Bun loading Layers ship in the package.
Validation includes native libFLAC oracles, corruption/fragmentation/cancellation and allocator tests, byte-for-byte Wasm rebuilds, and fresh packed consumers on Bun, Node, Chromium, Firefox, and WebKit for both advertised Effect peers. The server benchmark covers all 137 chunks across 30 stems with three serial warm rounds and exact PCM verification; detailed receipts and review evidence are recorded in issue #1's spec.
The final server run produced 425,689,892 FLAC bytes versus native’s 425,690,361 bytes. Median encoding time was 60.580 seconds for Wasm versus 15.554 seconds native (3.895×); all PCM hashes matched. The receipt documents a brief packed-test overlap in warm round 1.
Adapter, CLI, and transcoder integration remain separate changes. This PR does not publish an npm release.
Closes #1