Convert text to voice
Project description
Text to Audio SDK
The Yandex Text to Audio SDK is a Python package that allows you to convert text to audio using Yandex premium voices. It provides an easy-to-use asynchronous interface for generating audio files from text with customizable voice, speed, and other parameters.
Installation
You can install the SDK from PyPI using pip:
pip install txt2voice
Quick Start
Here's a simple example demonstrating how to use the SDK to convert text to audio:
import asyncio
from txt2voice.api import TextToVoice, RequestParams
from txt2voice.models import VoiceParams, SpeedParams, AudioContent
async def main():
token = 'YOUR_IAM_TOKEN'
folder_id = 'YOUR_FOLDER_ID'
text = 'Hello, this is an example text for audio conversion!'
output_file = 'output_audio.mp3'
api = TextToVoice(url='https://tts.api.cloud.yandex.net/speech/v1/tts:synthesize')
convert_params = RequestParams(
voice=VoiceParams(male='fillip', female='alyona'),
speed=SpeedParams(speed=1.0),
path_to_audiofiles=output_file,
folder_id=folder_id,
iam_token=token,
lang='ru-RU',
text=text
)
audio_content: AudioContent = await api.request_audio_content(convert_params)
api.convert_ogg_to_mp3(audio_content, 'output_audio.mp3')
if __name__ == '__main__':
asyncio.run(main())
Dependencies
The Yandex Text to Audio SDK has the following dependencies:
- aiohttp
- pydantic
- pydub
You can install them using pip with the following command:
pip install aiohttp pydantic pydub
Contributing
Contributions to the project are welcome! If you find a bug, have a feature request, or want to contribute code, please open an issue or submit a pull request.
License
This SDK is licensed under the MIT License. See the LICENSE file for details.
Happy audio conversion with Yandex Text to Audio SDK!
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file txt2voice-0.1.4.tar.gz.
File metadata
- Download URL: txt2voice-0.1.4.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eeaedb8d9ef477ef0511f509b2260eb6f2c56a2b37d048b7087af5146018ffe3
|
|
| MD5 |
6af193745163ab3203c4a30dd5b03b52
|
|
| BLAKE2b-256 |
6570762f984dd51ee216bdac6d990efc55a242679486ff32af64fc11fffc92a9
|
File details
Details for the file txt2voice-0.1.4-py3-none-any.whl.
File metadata
- Download URL: txt2voice-0.1.4-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a44a94615cacae321dd258539b6c8d3ecc1f4228fd2df3a26ae026406ab6850
|
|
| MD5 |
356b52d8ad86dfc2ee8ee706f7a72a58
|
|
| BLAKE2b-256 |
10806acd9c0f7ec9313c7a233f4a69371d4940c6c06cdc976c8ce48654576021
|