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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for speechkit-1.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a02442d769d19d11878536bb8f2e4f9269b464ed7c61db2be653dea6d03fd5d0 |
|
MD5 | 9bfd0c2ecc68214e03c791600c328e4b |
|
BLAKE2b-256 | 121ece9ec0c0742dd07ba89db4f0b380734bf5ce017797956d5a7c044bb0a87d |