Skip to main content

Package for realistic voice synthesis

Project description

voicesynth

Voice Synthesizing Library

[!NOTE] The project uses Silero TTS

How to use:

First, install the package
pip install voicesynth

Then import it into your code and go ahead and use it:

from voicesynth import say

say("Hello!")

Or

import voicesynth

voicesynth.say("Hello!")

Or if you want to specify a language/model, you can use it like this:

from voicesynth import Model, Synthesizer, show_available_models

show_available_models() # Showcase of all tts models available

# initializing the model
# setting show_download to False does not show model downloading progress
model = Model("v3_en", model_path="model.pt", show_download=False)  
model.set_speaker("en_73")

# creating a synthesizer instance
synthesizer = Synthesizer(model)
synthesizer.say("This is a good way to spend my day!")

Instead of using .say() method, you can synthesize an audio and then play it whenever you want

import time

synthesizer.synthesize("Whats'up!", path="audio.wav")
time.sleep(3)
synthesizer.audio.play_playsound("audio.wav")

There are multiple ways to play a synthesized audio:

model = Model("v4_ru", "model_ru.pt")
synthesizer = Synthesizer(model)

synthesizer.say("Как дела?", module="pygame") # Using pygame.mixer to play the audio
synthesizer.say("Хорошо, а твои как?", module="pydub") # Using pydub to play the audio

There are three ways to play the audio:

synthesizer.audio.play_playsound("audio.wav")
synthesizer.audio.play_pygame("audio.wav")
synthesizer.audio.play_pydub("audio.wav")

All models support simple ssml tags:

synthesizer.say("В н+едрах т+ундры в+ыдры п+ели п+есни", prosody_rate=90)   
# I added prosody as a parameter, so that people who are not familiar with ssml tags
# could change speaking speed without knowing how to manually do it

By default, logging is enabled. If it bothers you, you can disable it

from voicesynth import disable_logging

disable_logging()

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

voicesynth-0.2.1.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

voicesynth-0.2.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file voicesynth-0.2.1.tar.gz.

File metadata

  • Download URL: voicesynth-0.2.1.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for voicesynth-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b3799467afe785f9a63e737affe9db941ec0cd6aae76b881913c23300da1d070
MD5 f4b43b0796bbc237a44b2bfe24355db5
BLAKE2b-256 5eed07d1c08d3007e5d1e078ce9486eefbd5e35275b73241a9cde7925628f5e6

See more details on using hashes here.

File details

Details for the file voicesynth-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: voicesynth-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for voicesynth-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f3e95a388b4aa1e37c270f5e5c7071a854f8193371370fbe730397f0a373bede
MD5 e8eb5b6df9b3c82488504c277b43d6ce
BLAKE2b-256 468d97e41195a4944950c38ea6431411bf51bcc64d80dcc66bf99a10545ca362

See more details on using hashes here.

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