NLayer.NAudioSupport
2.0.1
dotnet add package NLayer.NAudioSupport --version 2.0.1
NuGet\Install-Package NLayer.NAudioSupport -Version 2.0.1
<PackageReference Include="NLayer.NAudioSupport" Version="2.0.1" />
<PackageVersion Include="NLayer.NAudioSupport" Version="2.0.1" />
<PackageReference Include="NLayer.NAudioSupport" />
paket add NLayer.NAudioSupport --version 2.0.1
#r "nuget: NLayer.NAudioSupport, 2.0.1"
#:package NLayer.NAudioSupport@2.0.1
#addin nuget:?package=NLayer.NAudioSupport&version=2.0.1
#tool nuget:?package=NLayer.NAudioSupport&version=2.0.1
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
- NAudio.Core (>= 2.0.0)
- NLayer (>= 2.0.1)
-
net8.0
- NAudio.Core (>= 2.0.0)
- NLayer (>= 2.0.1)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on NLayer.NAudioSupport:
| Package | Downloads |
|---|---|
|
MappingTools.Core
osu! mapping utility library built for Mapping Tools. |
|
|
Eyu.Audio
Package Description |
|
|
KevInc.UbiArt.Raki
Monolithic UbiArt RAKI audio wrapper parsing, encoding, and NAudio-backed codec adapters. |
GitHub repositories (5)
Showing the top 5 popular GitHub repositories that depend on NLayer.NAudioSupport:
| Repository | Stars |
|---|---|
|
openutau/OpenUtau
Open singing synthesis platform / Open source UTAU successor
|
|
|
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.
|
|
|
leezer3/OpenBVE
OpenBVE- A free train simulator
|
|
|
LiuYunPlayer/TuneLab
|
|
|
vocoder712/OpenUtauMobile
OpenUtau Mobile 是一个面向移动端的开源免费歌声合成软件; OpenUtau Mobile is a free and open-source singing voice synthesis software for mobile devices.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.1 | 1,653 | 7/6/2026 |
| 2.0.0 | 284 | 6/28/2026 |
| 2.0.0-preview.3 | 71 | 6/26/2026 |
| 2.0.0-preview.2 | 63 | 6/26/2026 |
| 1.4.0 | 303,003 | 12/18/2023 |
| 1.3.0 | 123,450 | 9/7/2021 |
| 1.2.0 | 14,112 | 2/8/2021 |
| 1.1.0 | 82,898 | 3/9/2020 |
| 1.0.0 | 84,851 | 2/4/2017 |
- Fixed Layer II decoding of grouped samples (closes #55). Three consecutive
samples of a low-allocation subband are packed into one codeword; the decoder
split it with the wrong radix (5/9/17 instead of 3/5/9), and two bit-allocation
table entries named the wrong quantization class. Together these distorted
Layer II audio — most audibly on low-bitrate MPEG-2 (LSF) streams — with loss of
bass and added high-frequency noise. Thanks @tokula for the fix in #56.
- Added regression tests covering the grouped-sample radix and the corrected
bit-allocation tables.