Skip to main content

It's lib for using speechkit api by yandex.

Project description

speechkit lib python

It's lib for using speechkit api by yandex.

This lib supports short and long audio recognition of speechkit

Install

pip install git+https://github.com/TikhonP/yandex-speechkit-lib-python.git

or

git clone https://github.com/TikhonP/yandex-speechkit-lib-python.git
sudo python setup.py install

How to use

Import:

from speechkit import speechkit

For short audio

Init:

spchkt = speechkit.RecognizeShortAudio(token)

Use token for getting iam

Recognize:

text = spchkt.recognize(filename, folder_id)

Please write folder_id

For long audio

For long audio you need to upload file to the yandex object storage. You can do it with objectStorage class:

objstor = speechkit.ObjectStorage(aws_access_key_id, aws_secret_access_key)

Speechkit works with ogg opus file. This function recoding audio with ffmpeg. It works only on unix system and you need to install ffmpeg.

out = speechkit.recode(infilename, outfilename)

It will save opus file to the same directory.

There is also supporting removing files by command rm

out = speechkit.removefile(inputfile)

They return '0', if process was done successfully

For synthesis

Init:

synthesizeAudio = speechkit.SynthesizeAudio(apiKey, catalogId

Use token and catalogID for getting iam

Synthesize and save to file

synthesizeAudio.synthesize(text, filepath, lpcm=False, voice='alena')

Synthesize and get bufferio data

data = synthesizeAudio.synthesize_stream(text, lpcm=False, voice='alena')

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

speechkit-1.2.2.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

speechkit-1.2.2-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

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