A comprehensive library for voice processing tasks such as wake word detection, speech recognition, translation, and text-to-speech.
Project description
VoiceProcessingToolkit
Introduction
VoiceProcessingToolkit is a Python library designed for voice processing tasks, including wake word detection, transcription, and synthesis. It aims to streamline the creation of voice-activated applications.
- Introduction
- Features
- Installation
- Usage
- Configuration
- Example Usage
- Contributing
- Support
- License
- Development Status
- Acknowledgements
- Contact Information
Features
- Wake word detection using Picovoice Porcupine.
- High-quality voice recording with adjustable settings for Voice Activation Detection.
- Fast and accurate speech-to-text transcription with OpenAI's Whisper.
- Customizable text-to-speech synthesis via ElevenLabs' API.
- Secure API key management with environment variables.
- Example scripts for easy demonstration and usage.
- Extensible architecture for feature additions and customization.
Installation
The VoiceProcessingToolkit is available on PyPI. To install, run the following command:
pip install VoiceProcessingToolkit
Usage
Basic Example
The following is a quick-start guide to using the toolkit for wake word detection and speech synthesis with auto-translation from any language to English.
from VoiceProcessingToolkit.VoiceProcessingManager import VoiceProcessingManager
from dotenv import load_dotenv
import logging
import os
# logging.basicConfig(level=logging.INFO)
load_dotenv()
# Set environment variables for API keys
os.getenv('PICOVOICE_APIKEY')
os.getenv('OPENAI_API_KEY')
os.getenv('ELEVENLABS_API_KEY')
# Create a VoiceProcessingManager instance with default settings
vpm = VoiceProcessingManager.create_default_instance(wake_word='computer')
# Run the voice processing manager with transcription and text-to-speech
text = vpm.run()
print(text)
Text-to-Speech Example
For text-to-speech conversion without recording, provide your own text as follows:
from VoiceProcessingToolkit.VoiceProcessingManager import text_to_speech_stream
from dotenv import load_dotenv
import logging
import os
# logging.basicConfig(level=logging.INFO)
load_dotenv()
# Set environment variables for API keys
os.getenv('ELEVENLABS_API_KEY')
text = "Hello, welcome to the Voice Processing Toolkit!"
print("Text to speech conversion in progress...")
text_to_speech_stream(text=text)
The VoiceProcessingManager
class is the central component of the toolkit, orchestrating the voice processing workflow. It is highly configurable, allowing you to tailor the behavior to your specific needs. Below are some of the key attributes and methods provided by this class:
Attributes of VoiceProcessingManager
include:
wake_word
: The wake word for triggering voice recording.sensitivity
: Sensitivity for wake word detection.output_directory
: Directory for saving recorded audio files<.audio_format
,channels
,rate
,frames_per_buffer
: Audio stream parameters.voice_threshold
,silence_limit
,inactivity_limit
,min_recording_length
,buffer_length
: Voice recording parameters.use_wake_word
: Flag to use wake word detection.save_wake_word_recordings
: Flag to save audio buffer that triggered the wake word detection.play_notification_sound
: Flag to play a sound on detection.
Methods of VoiceProcessingManager
include:
run(tts=False, streaming=False)
: Processes a voice command with optional text-to-speech functionality.setup()
: Initializes the components of the voice processing manager.process_voice_command()
: Processes a voice command using the configured components.
For a more detailed explanation of these attributes and methods, please refer to the inline documentation within the VoiceProcessingManager.py
file.
Getting Started
To begin using VoiceProcessingToolkit, follow these steps:
To get started with the VoiceProcessingToolkit, follow these simple steps:
-
Install the toolkit via pip:
pip install VoiceProcessingToolkit
-
Obtain API keys from Picovoice, OpenAI, and ElevenLabs.
-
Set the API keys as environment variables.
-
Run an example script from the
example_usage
directory. -
Customize
VoiceProcessingManager
settings as needed.
For a more detailed explanation of these steps, please refer to the inline documentation and example usage scripts provided in the toolkit. These resources provide detailed instructions on configuration, usage examples, and customization options.
If you have downloaded the github repository, you can run the examples from the example_usage
directory.
Rename the REMOVE_THIS_TEXT.env
file to .env
and add your API keys.
Example Usage
The example_usage
directory contains scripts showcasing various features:
- Simple Setup: Demonstrates the basic setup and usage of the VoiceProcessingManager.
- Create Wake Word Data: Demonstrates how to create a wake word dataset using the VoiceProcessingManager.
- Wake Word Decorators: Demonstrates how to register actions with the VoiceProcessingManager that will be triggered when the wake word is detected.
- Custom Recording Logic: Demonstrates custom recording settings and runs the VoiceProcessingManager without the wake word detector.
- Text to Speech: Demonstrates the text to speech functionality with text as input using the VoiceProcessingManager.
- Autogen_voice_assistant: Demonstrates how to use the VoiceProcessingManager to create a voice assistant with custom wake words and instructions.
Configuration
Customize the toolkit with settings like wake word sensitivity and audio sample rate. See the examples for more details.
Contributing
Contributions are welcome! See CONTRIBUTING.md for guidelines.
Support
For issues or questions, please use the GitHub issue tracker.
License
Licensed under the MIT License. See LICENSE for details.
Development Status
The project is in development. Feedback and contributions are appreciated.
Acknowledgements
Thanks to OpenAI, ElevenLabs, and Picovoice for their tools that enhance this project.
Contact Information
For help or inquiries, reach out via GitHub Discussions.
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 Distribution
Built Distribution
File details
Details for the file voiceprocessingtoolkit-0.1.8.2.tar.gz
.
File metadata
- Download URL: voiceprocessingtoolkit-0.1.8.2.tar.gz
- Upload date:
- Size: 111.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc8344c9fb86bd24ba6d1404d1b67771ed691f485540a44bcebd30eb5b6ec0b2 |
|
MD5 | 3af3c0e30f06ef3aaa00fe5c4e68e927 |
|
BLAKE2b-256 | cc3970681d7c3170fe5be9c44c356fa31197f1e6110d20938e39564b4975333c |
File details
Details for the file VoiceProcessingToolkit-0.1.8.2-py3-none-any.whl
.
File metadata
- Download URL: VoiceProcessingToolkit-0.1.8.2-py3-none-any.whl
- Upload date:
- Size: 112.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dacaa1f71616f25b81419b4a407407c7933ebf85e1b5a1213bbcfbe5c41b0601 |
|
MD5 | 66123a5377d97bc1486bd55872e2ae86 |
|
BLAKE2b-256 | def9d29e3695e315c435844eb24c7bc17bbd2c481e8eba4ef70dca7f7d8eeefd |