NLayer 2.0.0
dotnet add package NLayer --version 2.0.0
NuGet\Install-Package NLayer -Version 2.0.0
<PackageReference Include="NLayer" Version="2.0.0" />
<PackageVersion Include="NLayer" Version="2.0.0" />
<PackageReference Include="NLayer" />
paket add NLayer --version 2.0.0
#r "nuget: NLayer, 2.0.0"
#:package NLayer@2.0.0
#addin nuget:?package=NLayer&version=2.0.0
#tool nuget:?package=NLayer&version=2.0.0
NLayer
NLayer is a fully managed, MIT-licensed MP3 to WAV decoder implemented in C# based on the MPEG specifications.
NLayer targets netstandard2.0 and net8.0, so it runs on .NET Framework 4.6.1+, .NET 8+, Unity, and Mono.
Usage
To use NLayer for decoding MP3, first reference NLayer.
using NLayer;
Then create an MpegFile, pass a file name or a stream to the constructor, and use ReadSamples for decoding the content:
// samples per second times channel count
const int samplesCount = 44100;
var fileName = "myMp3File.mp3";
var mpegFile = new MpegFile(filename);
float[] samples = new float[samplesCount];
int readCount = mpegFile.ReadSamples(samples, 0, samplesCount);
More information could be found in code documents.
Use with NAudio
NLayer is capable of using in conjunction with NAudio for file conversion and real-time playback.
You need to reference NAudio, NLayer and NLayer.NAudioSupport first.
using NAudio.Wave;
using NLayer.NAudioSupport;
Then create an Mp3FileReader, passing in a FrameDecompressorBuilder that uses the Mp3FrameDecompressor from NLayer.NAudioSupport:
var fileName = "myMp3File.mp3";
var builder = new Mp3FileReader.FrameDecompressorBuilder(wf => new Mp3FrameDecompressor(wf));
var reader = new Mp3FileReaderBase(fileName, builder);
// play or process the file, e.g.:
waveOut.Init(reader);
waveOut.Play();
NLayer.NAudioSupportcurrently targets NAudio 2. NAudio 3 support (which carries breakingSpan<T>API changes) will follow once the NAudio 3 API stabilises.
Building
dotnet build NLayer.sln -c Release
dotnet test NLayer.sln -c Release
Every push and pull request is built and tested by the build GitHub Actions
workflow.
Assemblies are strong-named with NLayerStrongNameKey.snk (checked into the
repo root). Compiler warnings are treated as errors; the broader .NET
code-analysis (CA) analyzers are not enabled — turning them on surfaces ~110
mostly-mechanical style/perf suggestions that can be addressed incrementally.
Releasing
Versioning is centralised in Directory.Build.props (<VersionPrefix>) and
shared by both the NLayer and NLayer.NAudioSupport packages. Release notes
live in RELEASE_NOTES.md. Packages are published to NuGet by the release
workflow, which uses NuGet trusted publishing (OIDC) — no API key is stored in
the repository.
- Pre-release: run the
releaseworkflow manually (Actions → release → Run workflow) frommain. It publishes<VersionPrefix>-preview.<run>, or pass amilestonesuch asrc.1for<VersionPrefix>-rc.1. - Final release: bump
<VersionPrefix>, rename the### Unreleasedheading inRELEASE_NOTES.mdto### <version> (DD MMM YYYY), commit, then push a matchingv<version>tag (e.g.v2.0.0). The workflow packs, pushes to NuGet, and creates a GitHub Release.
See Docs/Releasing.md for the full step-by-step guide,
trusted-publishing setup, and troubleshooting.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (8)
Showing the top 5 NuGet packages that depend on NLayer:
| Package | Downloads |
|---|---|
|
NLayer.NAudioSupport
NAudio support for NLayer |
|
|
HPD-Agent.Framework
A middleware-driven agentic AI framework built on Microsoft.Extensions.AI for building intelligent, tool-using agents. |
|
|
YellowDogMan.CSCoreFork
Fork of CSCore by filoe |
|
|
Aural
A cross-platform audio playback library for WAV, OGG, and MP3 formats with real-time audio filters (low-pass, high-pass, reverb, pitch shift). Play audio with a single line of code |
|
|
Blitter
Blitter - a .NET graphics library. Class wrappers around SDL3 for graphics, input, audio, and more. Bundles the core Blitter library, SkiaSharp-powered image loading and Skia rendering helpers, and the Blitter.Blocks2D / Blitter.Blocks3D scene layers. |
GitHub repositories (5)
Showing the top 5 popular GitHub repositories that depend on NLayer:
| Repository | Stars |
|---|---|
|
ValveResourceFormat/ValveResourceFormat
Source 2 Viewer is an all-in-one tool to browse VPK archives, view, extract, and decompile Source 2 assets, including maps, models, materials, textures, sounds, and more.
|
|
|
Pyrdacor/Ambermoon.net
Ambermoon rewrite in C#
|
|
|
leezer3/OpenBVE
OpenBVE- A free train simulator
|
|
|
zhongkaifu/TensorSharp
A native .NET LLM inference engine for GGUF models. TensorSharp provides a console application, a web-based chatbot interface, and Ollama/OpenAI-compatible HTTP APIs for programmatic access. It supports Windows/MacOS/Linux with full GPU capability
|
|
|
bernatvadell/muonline
|
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 138 | 6/28/2026 |
| 2.0.0-preview.3 | 59 | 6/26/2026 |
| 2.0.0-preview.2 | 53 | 6/26/2026 |
| 1.16.0 | 86,938 | 10/8/2024 |
| 1.15.0 | 337,030 | 12/18/2023 |
| 1.14.0 | 190,635 | 9/7/2021 |
| 1.13.0 | 33,455 | 3/9/2020 |
| 1.12.0 | 105,347 | 6/19/2017 |
| 1.11.0 | 19,277 | 2/4/2017 |
- Modernised build: dropped `netstandard1.3`; packages now target
`netstandard2.0` and `net8.0`.
- Unified `NLayer` and `NLayer.NAudioSupport` on a single version (2.0.0).
- Reproducible, deterministic builds with SourceLink, embedded sources,
symbol packages (`.snupkg`) and an SPDX SBOM in each package.
- Packages now carry the `RepositoryUrl` and commit metadata (closes #31).
- Assemblies are now strong-named (closes #39).
- Packages now use the shared NAudio-family icon.
- Added GitHub Actions CI (build + test on every PR) and an automated
release workflow (pre-release via dispatch, final release via `v*` tag)
publishing to NuGet via trusted publishing (OIDC).
- Added an initial `NLayer.Tests` project.
- `NLayer.NAudioSupport` continues to target NAudio 2; NAudio 3 support
will follow once the NAudio 3 API stabilises.