{"id":28180,"library":"silk-python","title":"PySilk (silk-python)","description":"A Python binding for Silk, an audio codec originally developed by Skype. Supports encoding and decoding of Silk audio data (commonly used in Telegram voice messages). Current version 0.2.8; maintained on GitHub with occasional releases.","status":"active","version":"0.2.8","language":"python","source_language":"en","source_url":"https://github.com/synodriver/pysilk","tags":["audio","codec","silk","telegram","voip"],"install":[{"cmd":"pip install silk-python","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"wrong":"from silk import encode","symbol":"encode","correct":"from pysilk import encode"},{"symbol":"decode","correct":"from pysilk import decode"},{"symbol":"SilkError","correct":"from pysilk import SilkError"}],"quickstart":{"code":"import os\nimport asyncio\nfrom silk import encode, decode\n\n# Read binary data (example: from file)\nwith open('input.silk', 'rb') as f:\n    data = f.read()\n\n# Decode Silk to PCM\npcm = decode(data)\n\n# Encode PCM back to Silk\nsilk_data = encode(pcm['data'], rate=pcm['sample_rate'])\nprint(f\"Decoded {len(pcm['data'])} samples, encoded back to {len(silk_data)} bytes.\")","lang":"python","description":"Basic usage: read a Silk file, decode to PCM, then encode back to Silk."},"warnings":[{"fix":"Access pcm['data'] and pcm['sample_rate'].","message":"The `decode` function returns a dict with keys 'data' (numpy array or bytes) and 'sample_rate'. Do not assume it returns raw bytes only.","severity":"gotcha","affected_versions":"all"},{"fix":"Update to use pcm['data'] instead of pcm.","message":"In v0.1.x, the API used `silk.decode(data)` returning bytes directly. In v0.2.x, it returns a dict. Code written for v0.1.x will break.","severity":"deprecated","affected_versions":"v0.2.x"},{"fix":"Always supply `rate` from decoded PCM sample_rate.","message":"The `encode` function requires a `rate` parameter (sample rate). Common values: 24000, 16000, 8000. Omitting it may cause errors or wrong output.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.2.8':33 'audio':11,23,40 'bind':7 'codec':12,41 'common':25 'current':31 'data':24 'decod':20 'develop':14 'encod':18 'github':36 'maintain':34 'messag':30 'occasion':38 'origin':13 'pysilk':1 'python':4,6 'releas':39 'silk':3,9,22,42 'silk-python':2 'skype':16 'support':17 'telegram':28,43 'use':26 'version':32 'voic':29 'voip':44","created_at":"2026-05-09T05:54:08.727901+00:00","updated_at":"2026-05-09T05:54:08.727901+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/synodriver/pysilk","docs":null,"changelog":null,"pypi":"https://pypi.org/project/silk-python/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}