Skip to main content

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

  1. 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


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

NetHyTech_HindiTTS-1.1-py3-none-any.whl (3.1 kB view hashes)

Uploaded Python 3

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