Skip to main content

A customizable text-to-speech Python library

Project description

PB Speak Library

PB Speak is a Python library for text-to-speech functionality, designed to provide a simple and customizable way to convert text into spoken words. It uses the pyttsx3 library for offline text-to-speech synthesis.

Features

  • Customizable speaker name.
  • Adjustable speaking rate.
  • Supports multiple voices (male, female).
  • Easy-to-use interface.

Installation

Prerequisite

Ensure pyttsx3 is installed in your Python environment:

pip install pyttsx3

If the library is packaged, you can install it directly:

pip install pb_speak

Usage

Here's how to use the library in your Python code:

Import and Create an Instance

from pb_speak import pbSpeak

# Create an instance of the pbSpeak class
speaker = pbSpeak(name="Priyanshu", rate=180)

Speak Text

# Speak a simple text
speaker.speak("Hello! This is PB Speak in action.")

Parameters

  • name: The name of the speaker displayed in the console (default: "PB Speaker").
  • rate: The speech rate in words per minute (default: 170).
  • voice_index: The index of the voice to use (default: 1 for female voice, 0 for male voice).

Complete Example

Here’s a complete example of how to use PB Speak:

from pb_speak import pbSpeak

# Create a speaker instance with custom settings
speaker = pbSpeak(name="Priyanshu", rate=190, voice_index=0)

# Speak some text
speaker.speak("Welcome to the PB Speak library. Enjoy converting text to speech!")

Customization

  • Change Name: Specify a custom name for the speaker by passing it to the name parameter.
  • Adjust Rate: Modify the rate parameter to control the speed of the speech.
  • Select Voice: Use voice_index to choose a voice (e.g., 0 for male, 1 for female).

Development

If you'd like to contribute to the project, follow these steps:

  1. Clone the repository:

    git clone https://github.com/FalconX80/pb_speak.git
    
  2. Navigate to the project directory:

    cd pb_speak
    
  3. Install the library in editable mode:

    pip install -e .
    
  4. Test the library:

    from pb_speak import pbSpeak
    
    speaker = pbSpeak(name="Developer")
    speaker.speak("Thank you for contributing to PB Speak!")
    

License

This project is licensed under the MIT License. See the [LICENSE] file for details.

Author

Developed by Priyanshu Bhatt.
For inquiries, email: priyanshubhatt80@gmail.com.

Feedback and Contributions

  • Found a bug? Open an issue.
  • Have a feature request? Feel free to submit it.
  • Contributions are welcome! Submit a pull request with your changes.

Acknowledgments

This project uses the amazing pyttsx3 library for text-to-speech functionality.

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

pb_speak-1.0.2.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pb_speak-1.0.2-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file pb_speak-1.0.2.tar.gz.

File metadata

  • Download URL: pb_speak-1.0.2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for pb_speak-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b0606da7b97cdaee667d6c552c32dc90c640f043f8f62420be8c748aa809a4de
MD5 0515be21c9eba00be173e9d989105cbd
BLAKE2b-256 63365079bd0a691927e604d201c73567250fa791cf3a1fad46d17d9dca530682

See more details on using hashes here.

File details

Details for the file pb_speak-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: pb_speak-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for pb_speak-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2f1d6d10f8379c7443583fa69302705614ee165ccad804ba18a4f24719ee7757
MD5 c0882ff0e39062137972a531182ce6de
BLAKE2b-256 d51b49aa0ecd73b3ad917bb8586f14fe49d493d01e753e9de30aac9464aa4178

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page