{"id":16217231,"url":"https://github.com/synodriver/pysilk","last_synced_at":"2025-09-06T18:50:22.254Z","repository":{"id":40688614,"uuid":"337322565","full_name":"synodriver/pysilk","owner":"synodriver","description":"stream encoder/decoder for silk and pcm","archived":false,"fork":false,"pushed_at":"2024-03-27T00:09:35.000Z","size":3283,"stargazers_count":17,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"v0.2","last_synced_at":"2024-10-11T11:26:01.850Z","etag":null,"topics":["audio","cffi","cython","decoder","encoder","pcm","silk"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/synodriver.png","metadata":{"files":{"readme":"README.markdown","changelog":"changename.py","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-09T07:14:13.000Z","updated_at":"2024-09-30T09:57:26.000Z","dependencies_parsed_at":"2024-10-25T17:48:03.221Z","dependency_job_id":"aff2dc06-4e9d-418c-9972-6165c8f07c71","html_url":"https://github.com/synodriver/pysilk","commit_stats":{"total_commits":30,"total_committers":2,"mean_commits":15.0,"dds":0.06666666666666665,"last_synced_commit":"8499fd4584ab9af7c4e1a6867733ceb1e9e7f4cd"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fpysilk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fpysilk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fpysilk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fpysilk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/synodriver","download_url":"https://codeload.github.com/synodriver/pysilk/tar.gz/refs/heads/v0.2","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243982182,"owners_count":20378605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","cffi","cython","decoder","encoder","pcm","silk"],"created_at":"2024-10-10T11:26:11.597Z","updated_at":"2025-03-19T10:30:43.487Z","avatar_url":"https://github.com/synodriver.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\u003ci\u003e✨ pysilk ✨ \u003c/i\u003e\u003c/h1\u003e\n\n\u003ch3 align=\"center\"\u003eThe python binding for \u003ca href=\"https://github.com/kn007/silk-v3-decoder\"\u003esilk-v3-decoder\u003c/a\u003e \u003c/h3\u003e\n\n[![pypi](https://img.shields.io/pypi/v/silk-python.svg)](https://pypi.org/project/silk-python/)\n![python](https://img.shields.io/pypi/pyversions/silk-python)\n![implementation](https://img.shields.io/pypi/implementation/silk-python)\n![wheel](https://img.shields.io/pypi/wheel/silk-python)\n![license](https://img.shields.io/github/license/synodriver/pysilk.svg)\n![action](https://img.shields.io/github/workflow/status/synodriver/pysilk/build%20wheel)\n\n## 安装\n```bash\npip install silk-python\n```\n\n\n## 使用\n- encode\n```python\nimport pysilk\n\nwith open(\"verybiginput.pcm\", \"rb\") as pcm, open(\"output.silk\", \"wb\") as silk:\n    pysilk.encode(pcm, silk, 24000, 24000)\n```\n\n- decode\n\n```python\nimport pysilk\n\nwith open(\"verybiginput.silk\", \"rb\") as silk, open(\"output.pcm\", \"wb\") as pcm:\n    pysilk.decode(silk, pcm, 24000)\n```\n\n## 支持功能\n- 接受任何二进制的```file-like object```，比如```BytesIO```，可以流式解码大文件\n- 包装了silk的全部C接口的参数，当然他们都有合理的默认值\n- 基于```Cython```， [关键部位](https://github.com/synodriver/pysilk/blob/stream/pysilk/silk.pxd#L43-L65) 内联C函数，高性能\n\n\n## 公开函数\n```python\nfrom typing import BinaryIO\n\ndef 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) -\u003e None: ...\ndef 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) -\u003e None: ...\n```\n\n## 公开异常\n```python\nclass SilkError(Exception):\n    pass\n```\n\n### ✨v0.2.0✨\n合并了[CFFI](https://github.com/synodriver/pysilk-cffi) 的工作\n\n### 本机编译\n```\npython -m pip install setuptools wheel cython cffi\ngit clone https://github.com/synodriver/pysilk\ncd pysilk\ngit submodule update --init --recursive\npython setup.py bdist_wheel --use-cython --use-cffi\n```\n\n### 后端选择\n默认由py实现决定，在cpython上自动选择cython后端，在pypy上自动选择cffi后端，使用```SILK_USE_CFFI```环境变量可以强制选择cffi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynodriver%2Fpysilk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynodriver%2Fpysilk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynodriver%2Fpysilk/lists"}