Skip to main content

transform audio file to silk

Reason this release was yanked:

Do not have silkv3-extension in wheel file

Project description

Graiax-silkcoder

现在版本:pypi
这,是一个Python的silk转码器
通过将kn007/silk-v3-decoder通过简单的封装制成

安装

# 如果需要转换非wav的音频文件,则需要自行安装ffmpeg
pip install graiax-silkcoder
# 也可以通过下面的方式使用imageio-ffmpeg中的ffmpeg
pip install graiax-silkcoder[ffmpeg]

注: 假设你是Windows用户,安装时出现了error: Microsoft Visual C++ 14.0 is required: 请安装Microsoft C++ Build Tools

自定义ffmpeg_path

可能有一些用户会想要自定义ffmpeg的路径 你可以使用以下方法解决:

from graiax import silkcoder
silkcoder.set_ffmpeg_path("./ffmpeg")

使用方法

# 假设你是以 python -m asyncio 启动的python
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', ensure_ffmpeg=True)
#你也可以设置码率(默认状态下将会将尝试将目标语音大小限制在980kb上下)
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')
#你可以文件→二进制数据
wav: bytes=await silkcoder.decode('a.silk')
#你可以二进制数据→二进制数据(必填audio_format)
mp3: bytes=await silkcoder.decode(Path('a.silk').read_bytes(), audio_format='mp3')
#你可以二进制数据→文件
await silkcoder.decode(Path('a.silk').read_bytes(), 'a.wav')
#你可以指定让ffmpeg解码音频,也可以让程序自己选择
#注:只有当音频是wav且ensure_ffmpeg=None时才会不使用ffmpeg处理
await silkcoder.decode('a.silk', 'a.wav', ensure_ffmpeg=True)
#你也可以直接传入ffmpeg参数来输出
await silkcoder.decode('a.silk', 'a.mp3', ffmpeg_para=['-ab', '320k'])

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.1.3.tar.gz (205.7 kB view details)

Uploaded Source

Built Distributions

graiax_silkcoder-0.1.3-cp310-cp310-win_amd64.whl (7.1 kB view details)

Uploaded CPython 3.10 Windows x86-64

graiax_silkcoder-0.1.3-cp310-cp310-win32.whl (7.1 kB view details)

Uploaded CPython 3.10 Windows x86

graiax_silkcoder-0.1.3-cp39-cp39-win_amd64.whl (7.1 kB view details)

Uploaded CPython 3.9 Windows x86-64

graiax_silkcoder-0.1.3-cp39-cp39-win32.whl (7.1 kB view details)

Uploaded CPython 3.9 Windows x86

graiax_silkcoder-0.1.3-cp38-cp38-win_amd64.whl (7.1 kB view details)

Uploaded CPython 3.8 Windows x86-64

graiax_silkcoder-0.1.3-cp38-cp38-win32.whl (7.1 kB view details)

Uploaded CPython 3.8 Windows x86

File details

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

File metadata

  • Download URL: graiax-silkcoder-0.1.3.tar.gz
  • Upload date:
  • Size: 205.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for graiax-silkcoder-0.1.3.tar.gz
Algorithm Hash digest
SHA256 85f5f0bc76712fd63a8895f3b17bc500772fc18614567e6f1eeb38eeb04aa74b
MD5 db43a1b5fc603b75bbf2f8c2ea8eee39
BLAKE2b-256 8a945c0637c80f456f37ffa22c32be31260403d8bff64609e32997ee3789afa5

See more details on using hashes here.

File details

Details for the file graiax_silkcoder-0.1.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: graiax_silkcoder-0.1.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for graiax_silkcoder-0.1.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8cdcddd96ae610710c36063b98c865e6f243d59dfb9f33593c465c49cd9b25ea
MD5 0b66b84a39a92529d24bbcd9578197d8
BLAKE2b-256 a6818bae2f7a5e824d61dac0205c7eb982d220fdf4f132406656980f9d51f0ca

See more details on using hashes here.

File details

Details for the file graiax_silkcoder-0.1.3-cp310-cp310-win32.whl.

File metadata

  • Download URL: graiax_silkcoder-0.1.3-cp310-cp310-win32.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for graiax_silkcoder-0.1.3-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 04c5b37be9251ab524891c881f37b1309213db773c97f982b4d82d63a84f0a88
MD5 a3efa64aff4df4e9bdd4f095e707e223
BLAKE2b-256 cd4898456550a40d41ca23de4710e191b5dddf0914319ba2b7946584b5c74ff5

See more details on using hashes here.

File details

Details for the file graiax_silkcoder-0.1.3-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: graiax_silkcoder-0.1.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for graiax_silkcoder-0.1.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9433db9c1e40f3c5de79a44c6287caaae692eef3d84897d2cc9931222af935a2
MD5 458f84a884bbc659a546c8630da90c7b
BLAKE2b-256 f69c91471f2be1af298c1cec41807560a77553fbc16b67deef9070f26d975065

See more details on using hashes here.

File details

Details for the file graiax_silkcoder-0.1.3-cp39-cp39-win32.whl.

File metadata

  • Download URL: graiax_silkcoder-0.1.3-cp39-cp39-win32.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for graiax_silkcoder-0.1.3-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 527b90ec5c5a35b8a6cc0b548cd2602d9016cce4353e26ca9635d31940901381
MD5 a178ac62c51fdc39d3d681a0ede1feca
BLAKE2b-256 583315b6e43ff4d3f4f513d256cd8533c500e7f20e63b35854a5aa6eb55b9677

See more details on using hashes here.

File details

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

File metadata

  • Download URL: graiax_silkcoder-0.1.3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for graiax_silkcoder-0.1.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 53a920399c704919e4bf985ce3ce1f435db8df548c97198f2748bc651cb7c179
MD5 92f5466e394405db919955549133e74b
BLAKE2b-256 f54948045698c778404914c4102e0ba4b8692d24a712db46619f54cd7c23d2cc

See more details on using hashes here.

File details

Details for the file graiax_silkcoder-0.1.3-cp38-cp38-win32.whl.

File metadata

  • Download URL: graiax_silkcoder-0.1.3-cp38-cp38-win32.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for graiax_silkcoder-0.1.3-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 b5c91935080db65090465459a9d177b055e6bc03b2fa64f16b66be754dd315ed
MD5 84aca16695a1e51aad5456eefb1c1b2d
BLAKE2b-256 f64a8798728f0156d93ad28de09ad7cc4bfc1981aaf5f270e1dcd7e280886166

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