Text To Speech In British Brian Voice
Project description
Text-to-Speech (TTS) using Edge TTS and Pygame
This Python script provides a simple implementation of text-to-speech (TTS) using the Edge TTS API and Pygame library for audio playback.
Requirements
- Python 3.11.4
- edge_tts module (for Edge TTS API)
- Pygame library
Installation
- Install the required modules:
pip install NetHyTech-HindiTTS
Usage
The Speak
function in the script takes the text input and an optional output file path as arguments. If no output file path is provided, it saves the audio file as "speech.mp3" in the current directory.
Example usage:
from NetHyTech_HindiTTS import Speak
text = "Hello, how are you?"
Speak(text, "output.mp3") # Save audio to output.mp3
Functionality
- The
Speak
function converts the input text to speech using the Edge TTS API and saves it to the specified output file. - If no output file is provided, it saves the audio as "speech.mp3" in the current directory.
- The script handles the asynchronous operation using asyncio for better performance.
- Pygame is utilized for playing the generated audio file.
Additional Notes
- Ensure you have valid credentials for the Edge TTS API and replace the
VOICE
variable with the desired voice. - The
remove_file
function handles the removal of temporary files after audio playback. - Error handling is implemented to catch any exceptions during the process.
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for NetHyTech_HindiTTS-1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8595f09bec7142ba64691cc671a394327dc4e126de8440775ac667c6f8b0368f |
|
MD5 | 2f6eb71d0a5a196f3f1a47e1d5090dc9 |
|
BLAKE2b-256 | 3291e81cd24d5f9f96beb36e7fceb5e025a164564f9a2470e549a46f3661b035 |