Skip to main content

transform audio file to silk

Project description

Graiax-silkcoder

这,是一个Python的silk转码器

使用方法

from pathlib import Path
from graiax import silkcoder

#silk编码
#你可以文件→文件
await silkcoder.encode('a.wav', 'a.silk')
#你可以文件→二进制数据
silk: bytes=await silkcoder.encode('a.wav')
#你可以二进制数据→二进制数据
silk: bytes=await silkcoder.encode(Path('a.wav').read_bytes())
#你可以二进制数据→文件
await silkcoder.encode(Path('a.wav').read_bytes(), audio_format='wav', 'a.silk')
#你可以指定让ffmpeg解码音频,也可以让程序自己选择
#注:只有当音频是wav且ensure_ffmpeg=None时才会不使用ffmpeg处理
await silkcoder.encode('a.wav', 'a.silk')
await silkcoder.encode('a.wav', 'a.silk', ensure_ffmpeg=True)
#你也可以设置码率(默认65000)
await silkcoder.encode('a.wav', 'a.silk', rate=70000)
#你甚至可以剪辑音频
await silkcoder.encode('a.wav', 'a.silk', ss=10, t=5)#从第10s开始剪辑5s的音频

#silk解码
#你可以文件→文件
await silkcoder.decode('a.silk', 'a.wav')
#你可以文件→二进制数据
silk: bytes=await silkcoder.decode('a.silk')
#你可以二进制数据→二进制数据(必填audio_format)
silk: bytes=await silkcoder.decode(Path('a.silk').read_bytes(), audio_format='mp3')
#你可以二进制数据→文件
await silkcoder.encode(Path('a.silk').read_bytes(), 'a.wav')
#你可以指定让ffmpeg解码音频,也可以让程序自己选择
#注:只有当音频是wav且ensure_ffmpeg=None时才会不使用ffmpeg处理
await silkcoder.encode('a.wav', 'a.silk')
await silkcoder.encode('a.wav', 'a.silk', ensure_ffmpeg=True)
#你也可以设置码率(默认65000)
await silkcoder.encode('a.wav', 'a.silk', rate=70000)
#你甚至可以剪辑音频
await silkcoder.encode('a.wav', 'a.silk', ss=10, t=5)#从第10s开始剪辑5s的音频

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graiax-silkcoder-0.0.8.tar.gz (252.7 kB view details)

Uploaded Source

Built Distribution

graiax_silkcoder-0.0.8-cp38-cp38-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.8 Windows x86-64

File details

Details for the file graiax-silkcoder-0.0.8.tar.gz.

File metadata

  • Download URL: graiax-silkcoder-0.0.8.tar.gz
  • Upload date:
  • Size: 252.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.8.7 Windows/10

File hashes

Hashes for graiax-silkcoder-0.0.8.tar.gz
Algorithm Hash digest
SHA256 33632003c925b1aa9f97bf70271452eb4ec585bb640f38e2007f4be53cb08098
MD5 6e990c2e20ae74b3913f97e14256d723
BLAKE2b-256 1a590cc86ae283a7ac0978254c95c6d80da54366d0943c81a728b5e34d2e6af9

See more details on using hashes here.

File details

Details for the file graiax_silkcoder-0.0.8-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for graiax_silkcoder-0.0.8-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 5fb6b42752fbef8416c28a44bc01dd951885bb4f585f39b42a0603774787951d
MD5 10e202f2b490549a8c9c909617178887
BLAKE2b-256 988376341b4635ca982185f97f7e134795df44e413d743f143664406dfea28a9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page