DrAbc.SilkCodec 1.0.0

dotnet add package DrAbc.SilkCodec --version 1.0.0
                    
NuGet\Install-Package DrAbc.SilkCodec -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" 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" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DrAbc.SilkCodec" />
                    
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 --version 1.0.0
                    
#r "nuget: DrAbc.SilkCodec, 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@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&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DrAbc.SilkCodec&version=1.0.0
                    
Install as a Cake Tool

SilkCodec.NET

Build NuGet packages NuGet

Pure .NET Silk v3 speech codec. It encodes 16-bit little-endian PCM and decodes #!SILK_V3 streams, including the Tencent/WeChat leading 0x02 marker.

This library is written in C#. It does not load native silkcodec binaries and is not a conversion of the Skype SILK C sources.

Install

dotnet add package DrAbc.SilkCodec

Target frameworks: net10.0, net8.0, net472.

Encode

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

byte[] silk = encoder.Encode(File.ReadAllBytes("voice.pcm"));
encoder.Encode("voice.pcm", "voice.silk");

Decode

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

byte[] pcm = decoder.Decode(File.ReadAllBytes("voice.silk"));
decoder.Decode("voice.silk", "voice.pcm");

Extensions

The core package encodes and decodes raw 16-bit little-endian PCM. Companion packages convert other audio formats through popular C# audio libraries. Each extension is a separate NuGet package.

Package Formats Target
DrAbc.SilkCodec.NAudio Any format NAudio can read; write WAV, PCM, MP3, AAC/M4A, WMA, FLAC net10.0-windows
DrAbc.SilkCodec.CSCore Any format CSCore can read; write WAV, PCM, MP3, AAC/M4A, WMA net10.0-windows, net8.0-windows, net472
DrAbc.SilkCodec.FFMpegCore Any format FFmpeg can read or write net10.0, net8.0, net472 (FFmpeg required)
dotnet add package DrAbc.SilkCodec.NAudio
dotnet add package DrAbc.SilkCodec.CSCore
dotnet add package DrAbc.SilkCodec.FFMpegCore
using SilkCodec.NET;
using SilkCodec.NET.NAudio;

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

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

var decoder = new SilkDecoder(new SilkDecoderOptions { SampleRate = 24000 });
decoder.DecodeFile("voice.silk", "voice.wav");
byte[] wav = decoder.DecodeToWav(silk);

.pcm, .raw and .s16le files are treated as signed 16-bit little-endian mono at the encoder or decoder sample rate.

CLI

The repository includes a small command-line tool. It is a separate executable and is not included in the NuGet package.

dotnet run --project src/SilkCodec.NET.Cli -- encode voice.pcm voice.silk --tencent
dotnet run --project src/SilkCodec.NET.Cli -- decode voice.silk voice.pcm

Useful options:

silkcodec encode <input.pcm> [output.silk] [-r 24000] [-b 25000] [-t]
silkcodec decode <input.silk> [output.pcm] [-r 24000]

If the output path is omitted, the input extension is changed to .silk or .pcm.

Encode and decode print elapsed time. To compare throughput against the test clips:

dotnet run --project src/SilkCodec.NET.Cli -c Release -- bench tests/SilkCodec.NET.Tests/assets

Compatibility

  • Container: #!SILK_V3, optional Tencent 0x02 prefix, little-endian frame lengths, optional -1 terminator when not Tencent
  • Payload: Silk SDK 1.0.9 / WeChat-QQ Silk v3 range-coded frames
  • PCM: packed signed 16-bit little-endian, mono

The decoder reads existing Silk v3 files. The encoder emits a valid Silk v3 bitstream that this decoder (and other Silk v3 decoders) can play. Encoder output is not bit-identical to the Skype SDK.

License

MIT (Expat), see LICENSE.

Product Compatible and additional computed target framework versions.
.NET 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 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. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on DrAbc.SilkCodec:

Package Downloads
DrAbc.SilkCodec.CSCore

silk v3 codec CSCore extensions, support WeChat and QQ

DrAbc.SilkCodec.NAudio

silk v3 codec NAudio extensions, support WeChat and QQ

DrAbc.SilkCodec.FFMpegCore

silk v3 codec FFMpegCore extensions, support WeChat and QQ

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 102 8/26/2026