Hawkynt.FileFormats.Audio
1.0.0.88
dotnet add package Hawkynt.FileFormats.Audio --version 1.0.0.88
NuGet\Install-Package Hawkynt.FileFormats.Audio -Version 1.0.0.88
<PackageReference Include="Hawkynt.FileFormats.Audio" Version="1.0.0.88" />
<PackageVersion Include="Hawkynt.FileFormats.Audio" Version="1.0.0.88" />
<PackageReference Include="Hawkynt.FileFormats.Audio" />
paket add Hawkynt.FileFormats.Audio --version 1.0.0.88
#r "nuget: Hawkynt.FileFormats.Audio, 1.0.0.88"
#:package Hawkynt.FileFormats.Audio@1.0.0.88
#addin nuget:?package=Hawkynt.FileFormats.Audio&version=1.0.0.88
#tool nuget:?package=Hawkynt.FileFormats.Audio&version=1.0.0.88
Hawkynt.FileFormats.Audio
Pure-managed audio codecs and container readers / writers extracted from CompressionWorkbench. Sister package to
Hawkynt.FileFormats.Images/Hawkynt.FileFormats.Archives/Hawkynt.FileFormats.FileSystems, all built on top ofHawkynt.Compression.Core.
The package bundles every audio-domain assembly (codecs + containers + tracker / chiptune / game
audio bundles) into lib/, so consumers add a single dependency and get the full audio surface.
Hawkynt.Compression.Core ships separately and is referenced as a NuGet <dependency> rather
than bundled, so installing both packages doesn't create duplicate DLLs.
When to use this package
- You need a pure-managed audio codec without dragging in
libsamplerate/libflac/ FFmpeg - You're building a tool that needs to read or write WAV / AIFF / AU / FLAC / ALAC / OGG / MP3 / MIDI files from C# without Windows Media Foundation or platform-specific APIs
- You want to inspect tracker (MOD / S3M / XM / IT) or chiptune (PSF) files programmatically
- You're processing game audio bundles (Wwise BNK, FMOD, AKB, AWB) and need their layout
Skip it when:
- You only need raw PCM I/O —
Hawkynt.Compression.Corealready exposesCodec.Pcm.PcmCodec.SplitInterleavedPcm/ToWavBlobindirectly, and PCM is in the smallerHawkynt.Compression.Coregraph through its dependency chain - You need codec-quality features (resampling, normalisation, EBU R128 loudness) — those live in dedicated audio-DSP libraries; this package targets format I/O, not signal processing
Quick start
using Codec.Pcm;
using FileFormat.Wav;
// Read a stereo 16-bit WAV and split it into mono left/right WAVs.
var blob = File.ReadAllBytes("input.wav");
var parsed = new WavReader().Read(blob);
foreach (var (name, monoWav) in PcmCodec.SplitInterleavedPcm(
parsed.InterleavedPcm,
parsed.NumChannels,
parsed.SampleRate,
parsed.BitsPerSample))
File.WriteAllBytes($"{name}.wav", monoWav);
Contents
State legend:
- R — read / decode only.
- WORM — Write-Once-Read-Many: can list / extract / decode AND can synthesise / encode a fresh output from scratch, but cannot modify an existing file in place.
- R/W — full read + true encoder; codec or container can produce the format from PCM / source data.
Codecs (Codec.*)
| Codec | Family | State | Description |
|---|---|---|---|
Codec.Pcm |
PCM | R/W | Raw integer PCM (8 / 16 / 24 / 32-bit), interleaved + planar, channel splitting |
Codec.ALaw |
PCM (companded) | R/W | ITU-T G.711 A-law — true encode + decode |
Codec.MuLaw |
PCM (companded) | R/W | ITU-T G.711 mu-law — true encode + decode |
Codec.Midi |
Symbolic | R/W | SMF parsing + per-track re-emit (BuildSingleTrackFile) |
Codec.ImaAdpcm |
ADPCM | R | IMA / Intel ADPCM — decode only (no encoder) |
Codec.MsAdpcm |
ADPCM | R | Microsoft ADPCM — decode only (no encoder) |
Codec.Gsm610 |
Speech | R | GSM 6.10 RPE-LTP — decode only (no encoder) |
Codec.Mp3 |
Lossy | R | MPEG-1/2 Audio Layer III — decompress only (no encoder) |
Codec.Aac |
Lossy | R | Advanced Audio Coding (ADTS) — decompress only |
Codec.Vorbis |
Lossy | R | Vorbis I — decompress only (no encoder) |
Codec.Opus |
Lossy | R | Opus (RFC 6716) — decompress only (no encoder) |
Codec.Flac |
Lossless | R | FLAC frame-level — decompress only (no encoder) |
Honest scope note. Most lossy / lossless codecs in this package decode but don't encode. Writing a high-quality MP3 / AAC / Vorbis / Opus / FLAC encoder is a significant undertaking beyond the workbench's "no native deps" line in the sand and is out of scope for now. A-law / mu-law / PCM are simple enough that we ship full encoders. If you need to write lossy audio, reach for a dedicated encoder library; if you only need to read the format, this package covers it.
File-format containers (FileFormat.*)
| Container | State | Description |
|---|---|---|
FileFormat.Wav |
WORM | RIFF WAV — INFO / LIST / bext metadata, multi-channel layout |
FileFormat.Mp3 |
WORM | MP3 file with ID3v1 / ID3v2 tag readers (creates new MP3 streams) |
FileFormat.Flac |
WORM | FLAC stream + metadata blocks (STREAMINFO, VORBIS_COMMENT, PICTURE) |
FileFormat.Akb |
WORM | Square Enix audio bank |
FileFormat.Awb |
WORM | CRI Audio Wave Bank |
FileFormat.Psf |
WORM | PlayStation Sound Format (chiptune) |
FileFormat.Aiff |
R | Apple AIFF / AIFC — big-endian PCM container |
FileFormat.Au |
R | Sun / NeXT .au / .snd — 24-byte header + PCM |
FileFormat.Alac |
R | Apple Lossless inside MP4 atoms |
FileFormat.Ape |
R | Monkey's Audio (.ape) lossless |
FileFormat.WavPack |
R | WavPack lossless / hybrid |
FileFormat.Ogg |
R | OGG container — Vorbis / Opus / FLAC stream multiplexing |
FileFormat.Midi |
R | Standard MIDI File (SMF 0 / 1 / 2) container |
FileFormat.Mod |
R | ProTracker / SoundTracker MOD |
FileFormat.S3m |
R | Scream Tracker 3 |
FileFormat.Xm |
R | FastTracker II XM |
FileFormat.It |
R | Impulse Tracker IT |
FileFormat.WwiseBnk |
R | Audiokinetic Wwise SoundBank (game audio) |
FileFormat.Fmod |
R | FMOD bank container |
Codec implementation reference
Each codec has a Decompress(Stream input, Stream output) entry point producing interleaved
little-endian PCM and a ReadStreamInfo for metadata-only access. Encoders for the lossy /
lossless modern codecs are out of scope (see the scope note above) — only the legacy / simple
codecs ship with encoders.
| Codec | Project | Encoder | Decoder state | Reference |
|---|---|---|---|---|
| PCM | Codec.Pcm |
Yes | Production — raw integer PCM up to 32-bit | — |
| FLAC | Codec.Flac |
- | Production decode — FIXED + LPC subframes, all sample rates / bit depths | xiph.org/flac |
| A-law | Codec.ALaw |
Yes | Production — G.711 | ITU-T G.711 |
| μ-law | Codec.MuLaw |
Yes | Production — G.711 | ITU-T G.711 |
| GSM 06.10 | Codec.Gsm610 |
- | Production decode — full RPE-LTP | ETSI GSM 06.10 |
| IMA ADPCM | Codec.ImaAdpcm |
- | Production decode — Microsoft + Apple variants | IMA ADPCM spec |
| MS ADPCM | Codec.MsAdpcm |
- | Production decode — WAV format 0x0002 | MS ADPCM spec |
| MIDI | Codec.Midi |
Yes | Production — SMF 0/1/2 with all standard meta + channel events | MIDI 1.0 spec |
| MP3 | Codec.Mp3 |
- | Header + framing complete; bit-exact decode unverified. minimp3 port (1469 LOC, scalar) covering MPEG-1/2/2.5 Layer III, MS+intensity stereo, ID3v2 skip, Xing VBR. Layer I/II rejection passes. End-to-end PCM decode against a reference clip is deferred until an MP3 test vector lands in test-corpus/. |
ISO/IEC 11172-3 / minimp3 |
| Vorbis | Codec.Vorbis |
- | Partial. stb_vorbis structural port (1295 LOC) covering Ogg page reassembly, codebooks (lookup 0/1/2), floor 1, residue 0/1/2, channel coupling, IMDCT. Floor 0 throws NotSupportedException. End-to-end test marked Inconclusive until a test vector lands in test-corpus/. |
Vorbis I spec |
| Opus | Codec.Opus |
- | Framing only. Ogg page walker + OpusHead/OpusTags + TOC byte + frame packing modes 0/1/2/3 + range decoder (ec_dec) all real. CELT and SILK pipelines are stubs that emit silence at the correct sample count. Hybrid mode throws NotSupportedException. |
RFC 6716 |
| AAC-LC | Codec.Aac |
- | Framing only. ADTS frame parser + AudioSpecificConfig + element dispatcher + profile gating real. Spectral pipeline + Huffman tables + IMDCT + filterbank scaffolded but spectral data tables are TODO. HE-AAC v1/v2 + Main/SSR/LTP/ER all throw NotSupportedException. |
ISO/IEC 14496-3 |
Implementation philosophy. The four modern lossy codecs (MP3 / Vorbis / Opus / AAC-LC)
ship under the project's "no toy implementations" rule — partial state is documented openly
(in class summaries, in Assert.Ignore messages, and in the table above) rather than silently
producing wrong PCM. Future work: bit-pack debugging for MP3, real CELT/SILK for Opus,
spectral table population for AAC, reference test-vector validation across all four.
Versioning
This package version-locks 1:1 with Hawkynt.Compression.Core. Pin the same version across the
two packages — independent versioning would risk binary-incompatibility windows where a member
DLL bundled here was built against a different Compression.Core than the one a consumer
installs.
License
LGPL-3.0-or-later. See the source repository for the full license text and per-algorithm references.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Hawkynt.Compression.Core (>= 1.0.0.88)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.