Skip to main content

It's lib for using speechkit api by yandex.

Project description

Yandex Speechkit Python SDK

PyPI GitHub PyPI - Format Build Status Updates Python 3 codecov

Python SDK for Yandex Speechkit API.

For more information please visit Yandex Speechkit API Docs. This lib supports short and long audio recognition of speechkit

Getting Started

Assuming that you have Python and virtualenv installed, set up your environment and install the required dependencies like this, or you can install the library using pip:

$ git clone https://github.com/TikhonP/yandex-speechkit-lib-python.git
$ cd yandex-speechkit-lib-python
$ virtualenv venv
...
$ . venv/bin/activate
$ python -m pip install -r requirements.txt
$ python -m pip install .
python -m pip install speechkit

Using speechkit

There are support of recognizing long and short audio and synthesis. For more information please read docs below.

For short audio

From a Python interpreter:

import speechkit

recognizeShortAudio = speechkit.RecognizeShortAudio(str('<yandex_passport_oauth_token>'))
with open('/Users/tikhon/Desktop/out.wav', 'rb') as f:
    data = f.read()

print(recognizeShortAudio.recognize(data, folderId='<folder _id>', format='lpcm', sampleRateHertz='48000'))

'Текст который нужно распознать'

For synthesis

import speechkit

synthesizeAudio = speechkit.SynthesizeAudio(str('<yandex_passport_oauth_token>'))
synthesizeAudio.synthesize(str('/Users/tikhon/Desktop/out.wav'), text='Текст который нужно синтезировать',
                           voice='oksana', format='lpcm', sampleRateHertz='16000', folderId='<folder _id>')

For long audio

See long_audio_recognition.py

Speechkit documentation

See speechkit docs for more info.

Todo

License

Copyright 2021 Tikhon Petrishchev

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.4.0.tar.gz (13.2 kB view hashes)

Uploaded Source

Built Distribution

speechkit-1.4.0-py3-none-any.whl (12.4 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