CodeBrix.Audio.MitLicenseForever
1.0.212.307
See the version list below for details.
dotnet add package CodeBrix.Audio.MitLicenseForever --version 1.0.212.307
NuGet\Install-Package CodeBrix.Audio.MitLicenseForever -Version 1.0.212.307
<PackageReference Include="CodeBrix.Audio.MitLicenseForever" Version="1.0.212.307" />
<PackageVersion Include="CodeBrix.Audio.MitLicenseForever" Version="1.0.212.307" />
<PackageReference Include="CodeBrix.Audio.MitLicenseForever" />
paket add CodeBrix.Audio.MitLicenseForever --version 1.0.212.307
#r "nuget: CodeBrix.Audio.MitLicenseForever, 1.0.212.307"
#:package CodeBrix.Audio.MitLicenseForever@1.0.212.307
#addin nuget:?package=CodeBrix.Audio.MitLicenseForever&version=1.0.212.307
#tool nuget:?package=CodeBrix.Audio.MitLicenseForever&version=1.0.212.307
CodeBrix.Audio
A fully managed, cross-platform audio file library for .NET. CodeBrix.Audio reads WAV, MP3, Ogg Vorbis and FLAC waveform audio, reads and writes Standard MIDI Files, reads MP3 ID3v2 and Vorbis-comment tags, plays audio through a bundled cross-platform engine, and exposes a set of DSP primitives (FFT, biquad filters, envelope follower, voice-activity detection) for audio analysis — and it behaves identically on Windows, macOS, and Linux.
CodeBrix.Audio has no NuGet dependencies. It is provided as a .NET 10 library in the CodeBrix.Audio.MitLicenseForever NuGet package — which also bundles CodeBrix.Audio.Engine, a cross-platform audio engine with a native backend (see below). File decoding is fully managed; playback goes through that engine.
CodeBrix.Audio supports applications and assemblies that target Microsoft .NET version 10.0 and later. Microsoft .NET version 10.0 is a Long-Term Supported (LTS) version of .NET, and was released on Nov 11, 2025; and will be actively supported by Microsoft until Nov 14, 2028. Please update your C#/.NET code and projects to the latest LTS version of Microsoft .NET.
CodeBrix.Audio supports:
- Reading WAV (
.wav) waveform audio files: 8/16/24/32-bit PCM and 32/64-bit IEEE float, including WAVE_FORMAT_EXTENSIBLE files, plus A-law/μ-law. - Reading MP3 (
.mp3) waveform audio files via a fully managed MPEG audio decoder (no ACM/DMO, no native code). - Reading Ogg Vorbis (
.ogg) files, with exact duration and sample-accurate seeking. - Reading FLAC (
.flac) files losslessly, at 16-, 24- and 32-bit depths. - Writing WAV (
.wav) files. - Reading and writing Standard MIDI Files (
.mid). - Reading MP3 ID3v2 and Ogg/FLAC Vorbis-comment metadata tags.
- Playing audio: a media player with transport and seeking (
AudioFilePlayer), and decode-once sound effects that can overlap freely (SoundEffectClip). - Rendering SoundFonts (
.sf2) and playing MIDI music: a spec-faithful SoundFont renderer with the full generator and modulator model, per-voice LFOs and filter, reverb and chorus — driven by a transport-style player (MidiMusicPlayer) or rendered offline to a WAV file (SoundFontRenderer). - Playing SFZ (
.sfz) instruments: a fully managed SFZ engine measured at zero unimplemented opcodes across a 16-library, 155,000-region corpus of real free instruments — region selection (key/velocity/controller/program, round robins, random layers, key switches including ranges andsw_vel, release triggers withrt_decay, exclusive off groups with fast/normal/timed chokes,polyphonylimits, crossfades), the full modulation stack (amplifier envelope with shapes,vel2*andampeg_dynamic; filter, pitch and flexible envelopes; SFZ v1 and v2 LFOs with sub-waveforms and cross-modulation; two filters plus a three-band parametric EQ; ARIA variators, stereo width, per-voice randoms), and the_onccN/_curveccN/_smoothccNCC matrix with<curve>support and the ARIA extended sources (velocity, key delta, alternate, per-voice random…). The sameMidiMusicPlayerand offline renderer drive.sf2and.sfzinterchangeably; unknown opcodes are carried and reported (SfzInstrument.UnsupportedOpcodes), never fatal. - Audio analysis building blocks: fast Fourier transform, biquad filters, envelope follower, and voice-activity detection.
Sample Code
Read an audio file into samples
using CodeBrix.Audio.Wave;
// .wav, .mp3, .ogg or .flac - the extension picks the decoder
using var reader = new AudioFileReader("track.ogg");
float[] buffer = new float[reader.WaveFormat.SampleRate * reader.WaveFormat.Channels];
int read = reader.Read(buffer);
Play a sound effect, as often as you like
using CodeBrix.Audio.Playback;
using var laser = SoundEffectClip.Load("laser.ogg"); // decoded once, into memory
laser.Play(); // fire and forget
laser.Play(0.4f); // again, quieter, overlapping the first
Read and write a MIDI file
using CodeBrix.Audio.Midi;
var midi = new MidiFile("song.mid", strictChecking: false);
MidiFile.Export("song-copy.mid", midi.Events);
Play MIDI music through a SoundFont
using CodeBrix.Audio.Playback;
using CodeBrix.Audio.Synth;
var soundFonts = new SoundFontCache(); // a .sf2 is tens of MB - load it once, share it
var music = new MidiMusicPlayer();
music.Load(soundFonts.Get("GeneralUser.sf2"), new MidiSequence("level1.mid"));
music.IsLooping = true;
music.Play(); // same transport surface as AudioFilePlayer
Play MIDI music through an SFZ instrument
using CodeBrix.Audio.Playback;
using CodeBrix.Audio.Synth;
using CodeBrix.Audio.Synth.Sfz;
var instruments = new SfzInstrumentCache(); // samples decode once - load an instrument once, share it
var music = new MidiMusicPlayer();
music.Load(instruments.Get("VirtualPiano.sfz"), new MidiSequence("song.mid"));
music.Play(); // the same transport drives .sf2 and .sfz alike
// instruments.Get(...).UnsupportedOpcodes lists anything the file asked for that the
// engine does not implement - the first thing to check if a library sounds off.
Render MIDI music to a WAV file, with no audio device
using CodeBrix.Audio.Synth;
SoundFontRenderer.RenderToWavFile(
new SoundFont("GeneralUser.sf2"),
new MidiSequence("level1.mid"),
"level1.wav",
tail: TimeSpan.FromSeconds(2)); // let the reverb decay rather than cutting it
// The same renderer takes an SfzInstrument in place of the SoundFont.
Two SoundFont paths, on purpose.
CodeBrix.Audio.Synthis the renderer of record for playing a.sf2. The bundled Engine'sCodeBrix.Audio.Engine.Synthesisis a general-purpose synthesis architecture — oscillators, custom banks, MPE, arpeggiators — that can sample-play SF2 presets but has no modulators, per-voice LFO or per-voice filter. Use the first to reproduce somebody's SoundFont, the second to build an instrument.AGENT-README.txtcovers the split in detail.
CodeBrix.Audio.Engine (bundled audio engine)
The same CodeBrix.Audio.MitLicenseForever package also ships CodeBrix.Audio.Engine, a full cross-platform audio engine: audio playback and recording, effects, editing/mixing, MIDI, synthesis, and visualization. Its types live under the CodeBrix.Audio.Engine.* namespaces (separate from CodeBrix.Audio.*).
The Engine has a native dependency: a bundled codebrix_miniaudio backend (built from miniaudio, with an Ogg Vorbis decoder compiled in) shipped for seven runtime identifiers — Windows, macOS and Linux on x64 and ARM64, plus Linux on RISC-V 64. The correct native binary is selected automatically at runtime. It can be rebuilt from the sources in this repository; see tools/build_native_libraries/README.txt.
Parts of this library are adapted from open-source projects, and the FLAC decoder was written here from the format specification. See THIRD-PARTY-NOTICES.txt for the full provenance and license terms of everything incorporated.
Formats not included
Opus is deliberately not part of this package: it is BSD-3-Clause rather than MIT, so it ships separately as CodeBrix.Audio.Opus.BsdLicenseForever, which depends on this package and registers itself through the public extension points (SharedAudioOutput.RegisterCodecFactory and AudioFileReaderRegistry.Register). An Opus file opened without that package installed is recognised — duration, sample rate and channels all read — and fails with a message saying it is Opus.
License
The project is licensed under the MIT License. see: https://en.wikipedia.org/wiki/MIT_License
| 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
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on CodeBrix.Audio.MitLicenseForever:
| Package | Downloads |
|---|---|
|
CodeBrix.Platform.GameEngine.MitLicenseForever
A fully managed, cross-platform 2D and 2.5D game engine for .NET, with tile maps, sprites, layered scenes, camera/view systems, animation, physics/collision, input, audio, and SkiaSharp rendering. Includes the CodeBrix.Platform host layer. |
|
|
CodeBrix.Platform.AudioPlayer.ApacheLicenseForever
Audio playback for CodeBrix.Platform Skia apps on every head: Windows (Win32 and Skia-on-WPF), Linux (X11, Wayland, FrameBuffer), and macOS. Provides the XAML-declarable AudioPlayer element - a bindable WAV/MP3 player with play/pause/stop, seek, volume, looping, and a timecode position that two-way binds to a Slider for scrubbing - plus the SoundEffect class for fire-and-forget sound effects. Audio files load from file paths, ms-appx:/// asset URIs, embedded://Assembly/Resource.Name URIs (embedded resources), or streams. Playback is fully managed via CodeBrix.Audio (with its bundled codebrix_miniaudio native backend) - no other native audio dependency is required. |
|
|
CodeBrix.Audio.Opus.BsdLicenseForever
Fully managed Ogg Opus decoding and encoding for CodeBrix.Audio, with no native binaries on any platform. Registers itself with the CodeBrix.Audio engine so .opus files play through AudioFilePlayer, SoundEffectClip and the GameEngine, open by file name through AudioFileReader, and record through the engine's Recorder. Ships separately from CodeBrix.Audio because the Opus codec is BSD-3-Clause rather than MIT. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.212.816 | 46 | 7/31/2026 |
| 1.0.212.418 | 38 | 7/31/2026 |
| 1.0.212.307 | 39 | 7/31/2026 |
| 1.0.201.77 | 368 | 7/20/2026 |
| 1.0.199.38 | 117 | 7/18/2026 |
| 1.0.196.835 | 99 | 7/15/2026 |
| 1.0.196.416 | 88 | 7/15/2026 |
| 1.0.174.154 | 115 | 6/23/2026 |