From a3f84508ae4df5b07af88b359d0a6d0f71c580ff Mon Sep 17 00:00:00 2001 From: RTAkland Date: Sun, 17 Nov 2024 18:26:00 +0800 Subject: [PATCH] docs: add silk codec docs --- docs/README.md | 6 +++++- docs/silk.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 docs/silk.md diff --git a/docs/README.md b/docs/README.md index 8d4d704..fdcdc68 100644 --- a/docs/README.md +++ b/docs/README.md @@ -17,4 +17,8 @@ # QQBot -[QQBot](qqbot.md) \ No newline at end of file +[QQBot](qqbot.md) + +# Silk-Codec + +[Silk-Codec](silk.md) \ No newline at end of file diff --git a/docs/silk.md b/docs/silk.md new file mode 100644 index 0000000..f0ef128 --- /dev/null +++ b/docs/silk.md @@ -0,0 +1,28 @@ +# Silk Codec + +> 简单封装了Silk codec + +## 解码 + +```kotlin +fun main() { + val inputStream: InputStream = ... + val inputStreamSilkBytes: ByteArray = inputStream.decodeToSilk() + + val file: File = File("path/to/silk") + val fileSilkBytes: ByteArray = file.decodeToSilk() +} +``` + +## 编码 + +```kotlin +fun main() { + val sampleRate = 8000 // 采样率 + val inputStream: InputStream = ... + val inputStreamSilkBytes: ByteArray = inputStream.encodeToSilk(sampleRate) + + val file: File = File("path/to/silk") + val fileSilkBytes: ByteArray = file.encodeToSilk(sampleRate) +} +```