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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hawkynt.FileFormats.Audio" Version="1.0.0.88" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hawkynt.FileFormats.Audio" Version="1.0.0.88" />
                    
Directory.Packages.props
<PackageReference Include="Hawkynt.FileFormats.Audio" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Hawkynt.FileFormats.Audio --version 1.0.0.88
                    
#r "nuget: Hawkynt.FileFormats.Audio, 1.0.0.88"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Hawkynt.FileFormats.Audio@1.0.0.88
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Hawkynt.FileFormats.Audio&version=1.0.0.88
                    
Install as a Cake Addin
#tool nuget:?package=Hawkynt.FileFormats.Audio&version=1.0.0.88
                    
Install as a Cake Tool

Hawkynt.FileFormats.Audio

NuGet License

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 of Hawkynt.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.Core already exposes Codec.Pcm.PcmCodec.SplitInterleavedPcm / ToWavBlob indirectly, and PCM is in the smaller Hawkynt.Compression.Core graph 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0.88 0 5/6/2026
1.0.0.87 32 5/5/2026