DrAbc.SilkSharp 2.0.8

dotnet add package DrAbc.SilkSharp --version 2.0.8                
NuGet\Install-Package DrAbc.SilkSharp -Version 2.0.8                
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.SilkSharp" Version="2.0.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DrAbc.SilkSharp --version 2.0.8                
#r "nuget: DrAbc.SilkSharp, 2.0.8"                
#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.
// Install DrAbc.SilkSharp as a Cake Addin
#addin nuget:?package=DrAbc.SilkSharp&version=2.0.8

// Install DrAbc.SilkSharp as a Cake Tool
#tool nuget:?package=DrAbc.SilkSharp&version=2.0.8                

SilkSharp

alternate text is missing from this package README image NuGet Downloads

SilkSharp is a simple bundle of silk-codec https://github.com/foyoux/silk-codec

It converts audio in s16le format to and from silk v3 format.

Compatible with WeChat and QQ formats

Currently only win-x86 win-x64 linux-x86 linux-x64 linux-arm linux-arm64 osx-arm64 binary lib are available.


SilkSharp 是一个 silk-codec https://github.com/foyoux/silk-codec 的简单绑定

它实现s16le格式的音频与silk v3格式的相互转换

兼容微信和QQ格式

目前仅提供win-x86 win-x64 linux-x86 linux-x64 linux-arm linux-arm64 osx-arm64版本的二进制文件


😇Usage:

dotnet add package DrAbc.SilkSharp

在nuget搜索DrAbc.SilkSharp

search nuget package: DrAbc.SilkSharp

//Encoding
SilkEncoder encoder = new();
//File
encoder.EncodeAsync("./rasputin.pcm", "./rasputin.silk");
//Stream
using FileStream fse = File.OpenRead("./rasputin.pcm");
using MemoryStream mse = new(await encoder.EncodeAsync(fse));

//Decoding
SilkDecoder decoder = new();
//File
decoder.DecodeAsync("./badmoonrising.silk", "./badmoonrising.pcm");
//Stream
using FileStream fsd = File.OpenRead("./badmoonrising.silk");
using MemoryStream msd = new(await decoder.DecodeAsync(fsd));

E.g: Convert other audio to pcm (NAudio)

using NAudio.Wave;

using Mp3FileReader reader = new("input.mp3");
WaveFormat pcmFormat = new(16000, 16, 1);
using WaveFormatConversionStream conversionStream = new(pcmFormat, reader);
SilkEncoder encoder = new()
{
    //Same with your music
    Rate = 16000,
    FS_API = 16000,
    //QQ and Wechat Compatibility
    Tencent = true
};
using MemoryStream silk = new(await encoder.EncodeAsync(conversionStream));

See the SilkSharp.Demo project for more information

更多请参阅SilkSharp.Demo项目

🏗Build

If you are using win-arm or other system, please build this project from source

Not guaranteed it can be compiled on all architectural systems.

Preparation

  1. CMake 3.16 or above
  2. Dotnet 8.0 SDK
  3. git

C# code may compile on lower versions of dotnet, but I do not guarantee that it will behave like dotnet 8.0.

Steps

  1. Compile the silkcodec with CMake
git clone https://github.com/DrAbcOfficial/SilkSharp
cd SilkSharp/silkcodec
mkdir build && cd build
cmake ..
make
  1. Compile SilkSharp using dotnet (following the above command)
cd ../SilkSharp
dotnet publish -c Release -r osx-arm64
  1. Copy libsilkcodec.so (or silkcodec.dll/libsilkcodec.dylib) and SilkSharp.dll to your project.

如果你正在使用win-arm或其他架构系统,请自行从源代码构建本项目

不保证可在所有架构系统上编译

准备

  1. CMake 3.16或以上版本
  2. Dotnet 8.0 SDK
  3. git

C#代码可能可在dotnet更低版本上编译,但我不保证其行为与dotnet 8.0一致

步骤

  1. 使用CMake编译silkcodec
git clone https://github.com/DrAbcOfficial/SilkSharp
cd SilkSharp/silkcodec
mkdir build && cd build
cmake ..
make
  1. 使用dotnet编译SilkSharp (接上述命令)
cd ../SilkSharp
dotnet publish -c Release -r osx-arm64
  1. libsilkcodec.so(或silkcodec.dll/libsilkcodec.dylib)及SilkSharp.dll拷贝至你的项目使用
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DrAbc.SilkSharp:

Package Downloads
DrAbc.SilkSharp.NAudio

silk v3 codec binding, support WeChat and QQ

GitHub repositories

This package is not used by any popular GitHub repositories.