
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Python text-to-speech library with built-in voice effects and support for multiple TTS engines.
Python text-to-speech library with built-in voice effects and support for multiple TTS engines.
| GitHub | Documentation 📘 | Audio Samples 🔉 |
# Example: Use gTTS with a vocoder effect to speak in a robotic voice
from voicebox import SimpleVoicebox
from voicebox.tts import gTTS
from voicebox.effects import Vocoder, Normalize
voicebox = SimpleVoicebox(
tts=gTTS(),
effects=[Vocoder.build(), Normalize()],
)
voicebox.say('Hello, world! How are you today?')
pip install voicebox-tts
PortAudio
library for audio playback.
sudo apt install libportaudio2
Classes for supported TTS engines are located in the
voicebox.tts
package.
Online TTS engine from AWS.
voicebox.tts.AmazonPolly
pip install "voicebox-tts[amazon-polly]"
Online TTS engine with very realistic voices and support for voice cloning.
voicebox.tts.ElevenLabsTTS
pip install "voicebox-tts[elevenlabs]"
from elevenlabs.client import ElevenLabs
from voicebox.tts import ElevenLabsTTS
tts = ElevenLabsTTS(client=ElevenLabs(api_key='your-api-key'))
Offline TTS engine with a good number of options.
voicebox.tts.ESpeakNG
sudo apt install espeak-ng
Powerful online TTS engine offered by Google Cloud.
voicebox.tts.GoogleCloudTTS
pip install "voicebox-tts[google-cloud-tts]"
Online TTS engine used by Google Translate.
voicebox.tts.gTTS
pip install "voicebox-tts[gtts]"
Offline TTS engine released by Hugging Face that uses a promptable deep learning model to generate speech.
voicebox.tts.ParlerTTS
pip install git+https://github.com/huggingface/parler-tts.git
Very basic offline TTS engine.
voicebox.tts.PicoTTS
sudo apt install libttspico-utils
Offline TTS engine wrapper with support for the built-in TTS engines on Windows (SAPI5) and macOS (NSSpeechSynthesizer), as well as espeak on Linux. By default, it will use the most appropriate engine for your platform.
voicebox.tts.Pyttsx3TTS
pip install "voicebox-tts[pyttsx3]"
sudo apt install espeak
Built-in effect classes are located in the
voicebox.effects
package,
and can be imported like:
from voicebox.effects import CoolEffect
Here is a non-exhaustive list of fun effects:
Glitch
creates a glitchy sound by randomly repeating small chunks of audio.RingMod
can be used to create choppy, Doctor Who Dalek-like effects.Vocoder
is useful for making monotone, robotic voices.There is also support for all the awesome audio plugins in
Spotify's pedalboard
library
using the special PedalboardEffect
wrapper, e.g.:
from voicebox import SimpleVoicebox
from voicebox.effects import PedalboardEffect
import pedalboard
voicebox = SimpleVoicebox(
effects=[
PedalboardEffect(pedalboard.Reverb()),
...,
]
)
# PicoTTS is used to say "Hello, world!"
from voicebox import SimpleVoicebox
voicebox = SimpleVoicebox()
voicebox.say('Hello, world!')
Some pre-built voiceboxes are available in the
voicebox.examples
package.
They can be imported into your own code, and you can run them to demo:
# Voice of GLaDOS from the Portal video game series
python -m voicebox.examples.glados "optional message"
# Voice of the OOM-9 command battle droid from Star Wars: Episode I
python -m voicebox.examples.battle_droid "optional message"
# Use eSpeak NG at 120 WPM and en-us voice as the TTS engine
from voicebox import reliable_tts
from voicebox.tts import ESpeakConfig, ESpeakNG, gTTS
# Wrap multiple TTSs in retries and caches
tts = reliable_tts(
ttss=[
# Prefer using online TTS first
gTTS(),
# Fall back to offline TTS if online TTS fails
ESpeakNG(ESpeakConfig(speed=120, voice='en-us')),
],
)
# Add some voice effects
from voicebox.effects import Vocoder, Glitch, Normalize
effects = [
Vocoder.build(), # Make a robotic, monotone voice
Glitch(), # Randomly repeat small sections of audio
Normalize(), # Remove DC and make volume consistent
]
# Build audio sink
from voicebox.sinks import Distributor, SoundDevice, WaveFile
sink = Distributor([
SoundDevice(), # Send audio to playback device
WaveFile('speech.wav'), # Save audio to speech.wav file
])
# Build the voicebox
from voicebox import ParallelVoicebox
from voicebox.voiceboxes.splitter import SimpleSentenceSplitter
# Parallel voicebox doesn't block the main thread
voicebox = ParallelVoicebox(
tts,
effects,
sink,
# Split text into sentences to reduce time to first speech
text_splitter=SimpleSentenceSplitter(),
)
# Speak!
voicebox.say('Hello, world!')
# Wait for all audio to finish playing before exiting
voicebox.wait_until_done()
python -m voicebox -h # Print command help
python -m voicebox "Hello, world!" # Basic usage
FAQs
Python text-to-speech library with built-in voice effects and support for multiple TTS engines.
We found that voicebox-tts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.