Releases: kristofferv98/openai-voicestream
OpenAI VoiceStream v0.1.2
OpenAI VoiceStream v0.1.2
Description
OpenAI VoiceStream is a Python package designed to convert text to speech using the OpenAI API. This package allows for seamless integration with applications requiring real-time or batch processing of text into audio, supporting multiple voices for varied use cases.
Features
- Text to Speech Conversion: Convert blocks of text or streaming tokens into high-quality speech.
- Multiple Voices: Support for different voices including alloy, echo, fable, onyx, nova, and shimmer.
- Real-time Processing: Handles streaming of tokens and paragraphs, generating audio as the text is received.
- Thread Management: Efficiently manages threading to ensure smooth audio processing and playback.
Installation
To install the package, use pip:
pip install openai-voicestream
Usage
Here's a basic example of how to use the VoiceProcessor class:
import os
import time
from Voice_generator.VoiceProcessor import VoiceProcessor
# Set your OpenAI API key
api_key = os.getenv("OPENAI_API_KEY")
# Initialize the VoiceProcessor with the API key and desired voice
processor = VoiceProcessor(api_key, voice=3, full_quality=True) # You can change the voice here or sett quality to full_quality=True for hd voice
# Example text with paragraphs to be processed
text = """This is the first paragraph.
This is the second paragraph, which is a bit longer and might need more processing time.
Here is the third paragraph."""
# Add the text to the processing queue
processor.add_text_to_queue(text)
# Example tokens being added to the processing queue
tokens = ["Token 1, ", "token 2,", "Token 3 are processed as one sentence\n\n", "Token 4, ", "token 5."]
for token in tokens:
processor.add_token(token)
time.sleep(0.5) # Simulate a delay between receiving tokens
# Finalize any remaining tokens in the buffer
processor.finalize_tokens()
# Wait for all processing to complete before exiting
processor.wait_for_completion()
Documentation
For more detailed documentation and usage examples, please refer to the README.md file in the repository.
Contributing
We welcome contributions! Please see the CONTRIBUTING.md file for more details on how to get started.
License
This project is licensed under the MIT License - see the LICENSE file for details.
OpenAI VoiceStream v0.1.1
OpenAI VoiceStream v0.1.1
Description
OpenAI VoiceStream is a Python package designed to convert text to speech using the OpenAI API. This package allows for seamless integration with applications requiring real-time or batch processing of text into audio, supporting multiple voices for varied use cases.
Features
- Text to Speech Conversion: Convert blocks of text or streaming tokens into high-quality speech.
- Multiple Voices: Support for different voices including alloy, echo, fable, onyx, nova, and shimmer.
- Real-time Processing: Handles streaming of tokens and paragraphs, generating audio as the text is received.
- Thread Management: Efficiently manages threading to ensure smooth audio processing and playback.
Installation
To install the package, use pip:
pip install openai-voicestream
Usage
Here's a basic example of how to use the VoiceProcessor class:
import os
import time
from Voice_generator.VoiceProcessor import VoiceProcessor
# Set your OpenAI API key
api_key = os.getenv("OPENAI_API_KEY")
# Initialize the VoiceProcessor with the API key and desired voice
processor = VoiceProcessor(api_key, voice=3) # You can change the voice here
# Example text with paragraphs to be processed
text = """This is the first paragraph.
This is the second paragraph, which is a bit longer and might need more processing time.
Here is the third paragraph."""
# Add the text to the processing queue
processor.add_text_to_queue(text)
# Example tokens being added to the processing queue
tokens = ["Token 1, ", "token 2,", "Token 3 are processed as one sentence\n\n", "Token 4, ", "token 5."]
for token in tokens:
processor.add_token(token)
time.sleep(0.5) # Simulate a delay between receiving tokens
# Finalize any remaining tokens in the buffer
processor.finalize_tokens()
# Wait for all processing to complete before exiting
processor.wait_for_completion()
Documentation
For more detailed documentation and usage examples, please refer to the README.md file in the repository.
Contributing
We welcome contributions! Please see the CONTRIBUTING.md file for more details on how to get started.
License
This project is licensed under the MIT License - see the LICENSE file for details.