Skip to content

+ make legacy audio writers real - #105

Merged
Hawkynt merged 2 commits into
mainfrom
feat/audio-rw-codecs
Aug 29, 2026
Merged

+ make legacy audio writers real#105
Hawkynt merged 2 commits into
mainfrom
feat/audio-rw-codecs

Conversation

@Hawkynt

@Hawkynt Hawkynt commented Aug 28, 2026

Copy link
Copy Markdown
Owner

What changed

  • add Microsoft/Intel IMA ADPCM WAV-block encoding
  • add Apple/QuickTime ima4 packet encoding
  • add Microsoft ADPCM encoding with canonical predictor-pair search and adaptive delta state
  • add mono/stereo, packet-layout, padding, determinism and lossy-tolerance tests for both ADPCM families
  • make FileFormat.Bonk creatable from one/two mono PCM16 WAV channels using the codec's existing lossless writer
  • add byte-exact Bonk container creation tests
  • bundle the already-writable QOA, DFPWM and Bonk codec/format assemblies in Hawkynt.FileFormats.Audio

Verification

  • independent state-machine checks were run against representative mono/stereo signals for the new ADPCM quantizers
  • repository test coverage was added for all new write paths
  • GitHub CI is the authoritative build/test tier for this branch because the execution host here has no .NET SDK installed

Scope note

This deliberately does not claim fake encoders for MP3/AAC/Opus/Vorbis/WMA/DTS/etc. Those require real psychoacoustic/transform encoders and interoperability vectors; flipping the matrix without that machinery would be worse than leaving them read-only.

@Hawkynt
Hawkynt force-pushed the feat/audio-rw-codecs branch 3 times, most recently from b4e1e1f to c509d03 Compare August 29, 2026 03:45
@Hawkynt Hawkynt closed this Aug 29, 2026
@Hawkynt Hawkynt reopened this Aug 29, 2026
@Hawkynt
Hawkynt force-pushed the feat/audio-rw-codecs branch from 893ba17 to 60dc369 Compare August 29, 2026 05:19
Adds Microsoft/Intel IMA ADPCM WAV-block encoding, Apple ima4 packet encoding,
and Microsoft ADPCM with a canonical predictor-pair search and adaptive delta
state, with mono/stereo, packet-layout, padding, determinism and lossy-tolerance
coverage for both families. Bonk becomes creatable from one or two mono PCM16
WAV channels through the codec's own lossless writer, with byte-exact container
tests, and the writable QOA, DFPWM and Bonk assemblies are bundled in
Hawkynt.FileFormats.Audio.

Both decoders clamped a byte against an int literal, which is ambiguous.
@Hawkynt
Hawkynt force-pushed the feat/audio-rw-codecs branch from 60dc369 to 19ed2c5 Compare August 29, 2026 08:49
@Hawkynt
Hawkynt force-pushed the feat/audio-rw-codecs branch from 19ed2c5 to 92b2035 Compare August 29, 2026 09:09
@Hawkynt
Hawkynt merged commit a3f8c7d into main Aug 29, 2026
3 checks passed
@Hawkynt
Hawkynt deleted the feat/audio-rw-codecs branch August 29, 2026 09:58
Hawkynt added a commit that referenced this pull request Aug 29, 2026
… building (#127)

#105 and #106 were each green on their own branch and collided on the squash
commit no run ever saw. #106 added the span-based encoders in
{Ima,Ms}AdpcmCodec.Encode.cs; #105 then rewrote {Ima,Ms}AdpcmCodec.cs to carry
its own list-based encoders, re-declaring helpers the partial already had.

Both public surfaces stay - AdpcmEncodeTests covers the list-based pair and
AdpcmEncoderTests the span-based pair, so neither is dead.

IMA: the two EncodeNibble bodies were the same quantizer, so the partial's copy
goes and every caller uses the one in the main file; short widens to int. Its
copies of QuickTimePacketBytes, QuickTimeSamplesPerPacket and StartIndexFor go
for the same reason.

MS: the two are genuinely different - the main file quantizes the residual
directly, the partial searches all sixteen nibbles for the smallest error - so
the partial's keeps its body and takes the name SearchNibble. Sharing the name
was what made a short argument silently pick the search over the quantizer.
DecodeNibble takes the predictor index by value now that it is no longer
mutated per nibble, which is what the rewrite in #105 established.
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