DrAbc.SilkCodec.NAudio 1.0.0

dotnet add package DrAbc.SilkCodec.NAudio --version 1.0.0
                    
NuGet\Install-Package DrAbc.SilkCodec.NAudio -Version 1.0.0
                    
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="DrAbc.SilkCodec.NAudio" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DrAbc.SilkCodec.NAudio" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DrAbc.SilkCodec.NAudio" />
                    
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 DrAbc.SilkCodec.NAudio --version 1.0.0
                    
#r "nuget: DrAbc.SilkCodec.NAudio, 1.0.0"
                    
#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 DrAbc.SilkCodec.NAudio@1.0.0
                    
#: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=DrAbc.SilkCodec.NAudio&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DrAbc.SilkCodec.NAudio&version=1.0.0
                    
Install as a Cake Tool

SilkCodec.NET.NAudio

NAudio extensions for SilkCodec.NET. Convert any NAudio-readable audio format to Silk v3, and decode Silk v3 to WAV, PCM, MP3, AAC/M4A, WMA or FLAC.

Windows only (net10.0-windows). Compressed formats use Media Foundation.

Install

dotnet add package SilkCodec.NET.NAudio

Encode

using SilkCodec.NET;
using SilkCodec.NET.NAudio;
using NAudio.Wave;

var encoder = new SilkEncoder(new SilkEncoderOptions
{
    SampleRate = 24000,
    BitRate = 25000,
    Tencent = true
});

byte[] silk = encoder.EncodeFile("voice.mp3");
encoder.EncodeFile("voice.wav", "voice.silk");

using var reader = new AudioFileReader("voice.m4a");
byte[] fromReader = encoder.Encode(reader);
byte[] fromProvider = ((IWaveProvider)reader).ToSilk(encoder.Options);

.pcm, .raw and .s16le files are treated as signed 16-bit little-endian mono at encoder.Options.SampleRate.

Decode

var decoder = new SilkDecoder(new SilkDecoderOptions { SampleRate = 24000 });

decoder.DecodeFile("voice.silk", "voice.wav");
decoder.DecodeFile("voice.silk", "voice.mp3");
byte[] wav = decoder.DecodeToWav(File.ReadAllBytes("voice.silk"));

using RawSourceWaveStream wave = decoder.DecodeToWaveStream(File.ReadAllBytes("voice.silk"));

Output format is inferred from the file extension: .wav, .pcm/.raw/.s16le, .mp3, .m4a/.aac/.mp4, .wma, .flac.

MP3, AAC and WMA encoding may resample to 44.1 kHz because Windows Media Foundation often rejects 24 kHz mono.

License

MIT (Expat), see the repository LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
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 74 8/26/2026