Skip to main content

silk v3 codec, support WeChat and QQ

Total Downloads
155
155
Published
Aug 26, 2026
1mo ago

Get Started

dotnet add package DrAbc.SilkCodec --version 1.0.0
ProductVersions
.NET
net10.0net8.0
Other
.NETFramework4.7.2

README

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.

Downloads by Version

Not enough data for chart

Similar & Alternative Packages

Hand-picked matching NuGet libraries based on tags & ecosystem

Depended On By

Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 3 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.