Simplifies arranging text fragments with multiple speakers and processing it with coqui.ai TTS
Project description
TTS Arranger
A library that simplifies arranging text items fragments with multiple speakers and processing them using coqui.ai TTS to write audio files.
Examples
from tts_arranger import (TTS_Chapter, TTS_Item, TTS_Project,
TTS_Simple_Writer, TTS_Writer)
# Simple example using Simple Writer (using a simple list of TTS items)
tts_items = []
preferred_speakers = ['p273', 'p330']
tts_items.append(TTS_Item('This is a test', 1))
tts_items.append(TTS_Item(length=2000)) # Insert pause
tts_items.append(TTS_Item('This is a test with another speaker and a fixed minimum length', 0, length=10000))
simple_writer = TTS_Simple_Writer(tts_items, preferred_speakers)
simple_writer.synthesize_and_write('/tmp/tts_arranger_example_output/test.mp3')
# English example using tts_models/en/vctk/vits (with multispeaker support)
items1 = []
items1.append(TTS_Item('This is a test:', 0))
items1.append(TTS_Item('This is another test:', 1))
items2 = []
items2.append(TTS_Item('Another test', 0))
items2.append(TTS_Item('This is getting boring!', 1))
chapter = []
chapter.append(TTS_Chapter(items1, 'Chapter 1'))
chapter.append(TTS_Chapter(items2, 'Chapter 2'))
project = TTS_Project(chapter, 'Project title', 'This is a subtitle', author='Some author')
# Add a cover image
project.add_image_from_url('https://coqui.ai/static/38a06ec53309f617be3eb3b8b9367abf/598c3/logo-wordmark.png')
writer = TTS_Writer(project, '/tmp/tts_arranger_example_output/', preferred_speakers=preferred_speakers)
writer.synthesize_and_write(project.author + ' - ' + project.title)
# German example using Thorsten voice (no multispeaker support)
items1 = []
items1.append(TTS_Item('Dies ist ein Test:', speaker_idx=0))
items1.append(TTS_Item('Noch ein Test:', speaker_idx=1))
items2 = []
items2.append(TTS_Item('Ein weiterer Test', speaker_idx=0))
items2.append(TTS_Item('Langsam wird es langweilig!', speaker_idx=1))
chapter = []
chapter.append(TTS_Chapter(items1, 'Kapitel 1'))
chapter.append(TTS_Chapter(items2, 'Kapitel 2'))
project = TTS_Project(chapter, 'Projektname', 'Dies ist ein Untertitel', author='Ein Autor', lang_code='de')
writer = TTS_Writer(project, '/tmp/tts_arranger_example_output/', model='tts_models/de/thorsten/tacotron2-DDC', vocoder='vocoder_models/de/thorsten/hifigan_v1', output_format='mp3')
writer.synthesize_and_write(project.author + ' - ' + project.title, concat=False)
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
tts_arranger-0.3.0.tar.gz
(29.3 kB
view details)
Built Distribution
File details
Details for the file tts_arranger-0.3.0.tar.gz
.
File metadata
- Download URL: tts_arranger-0.3.0.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dbcce63e089b9d92d1253bc303ae6a8b13178d7cad721dc92ebc5ffec04069b |
|
MD5 | eb9de7d667458a36a6c4fa7029dadafe |
|
BLAKE2b-256 | 95781aa0684c91147e2c3939fcc284aee3ff9b9bbc8008fbf263da455ce95445 |
File details
Details for the file tts_arranger-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: tts_arranger-0.3.0-py3-none-any.whl
- Upload date:
- Size: 36.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5377c6256fa537293fedde32ed5aaf0c094190ccb9e585183e94f12b58a7d78 |
|
MD5 | 3a6386fb09a7008fb4f924d9d09489c3 |
|
BLAKE2b-256 | 790bccec017920713a645f2b18386e17b94a8fde800ace0e9c142797e073f0ee |