https://github.com/synodriver/pysilk-cffi
silk for pypy
https://github.com/synodriver/pysilk-cffi
Last synced: 9 months ago
JSON representation
silk for pypy
- Host: GitHub
- URL: https://github.com/synodriver/pysilk-cffi
- Owner: synodriver
- Created: 2022-06-27T15:19:30.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-28T08:31:55.000Z (almost 4 years ago)
- Last Synced: 2025-07-02T09:44:12.131Z (11 months ago)
- Language: Python
- Size: 1.49 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- Changelog: changename.py
Awesome Lists containing this project
README
✨ pysilk-cffi ✨
The cffi binding for silk-v3-decoder
[](https://pypi.org/project/pysilk-cffi/)





## 安装
```bash
pip install pysilk-cffi
```
## 使用
- encode
```python
import pysilk
with open("verybiginput.pcm", "rb") as pcm, open("output.silk", "wb") as silk:
pysilk.encode(pcm, silk, 24000, 24000)
```
- decode
```python
import pysilk
with open("verybiginput.silk", "rb") as silk, open("output.pcm", "wb") as pcm:
pysilk.decode(silk, pcm, 24000)
```
## 支持功能
- 接受任何二进制的```file-like object```,比如```BytesIO```,可以流式解码大文件
- 包装了silk的全部C接口的参数,当然他们都有合理的默认值
## 公开函数
```python
from typing import BinaryIO
def encode(input: BinaryIO, output: BinaryIO, sample_rate: int, bit_rate: int, max_internal_sample_rate: int = 24000, packet_loss_percentage: int = 0, complexity: int = 2, use_inband_fec: bool = False, use_dtx: bool = False, tencent: bool = True) -> bytes: ...
def decode(input: BinaryIO, output: BinaryIO, sample_rate: int, frame_size: int = 0, frames_per_packet: int = 1, more_internal_decoder_frames: bool = False, in_band_fec_offset: int = 0, loss: bool = False) -> bytes: ...
```
## 公开异常
```python
class SilkError(Exception):
pass
```