Git Product home page Git Product logo

pysilk's Introduction

✨ pysilk ✨

The python binding for silk-v3-decoder

pypi python implementation wheel license action

安装

pip install silk-python

使用

  • encode
import pysilk

with open("verybiginput.pcm", "rb") as pcm, open("output.silk", "wb") as silk:
    pysilk.encode(pcm, silk, 24000, 24000)
  • decode
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接口的参数,当然他们都有合理的默认值
  • 基于Cython关键部位 内联C函数,高性能

公开函数

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) -> None: ...
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) -> None: ...

公开异常

class SilkError(Exception):
    pass

✨v0.2.0✨

合并了CFFI 的工作

本机编译

python -m pip install setuptools wheel cython cffi
git clone https://github.com/synodriver/pysilk
cd pysilk
git submodule update --init --recursive
python setup.py bdist_wheel --use-cython --use-cffi

后端选择

默认由py实现决定,在cpython上自动选择cython后端,在pypy上自动选择cffi后端,使用SILK_USE_CFFI环境变量可以强制选择cffi

pysilk's People

Contributors

synodriver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pysilk's Issues

error

pysilk.decode(silk, pcm, 24000)

File "pysilk\backends\cython_silk.pyx", line 271, in pysilk.backends.cython._silk.decode
pysilk.backends.cython._silk.SilkError: DEC_PAYLOAD_TOO_LARGE

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.