Openai-voicestream

Latest version: v0.1.2

Safety actively analyzes 641872 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

0.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:

bash
pip install openai-voicestream


Usage
Here's a basic example of how to use the VoiceProcessor class:

python
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](README.md) file in the repository.

Contributing
We welcome contributions! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more details on how to get started.

License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

0.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:

bash
pip install openai-voicestream


Usage
Here's a basic example of how to use the VoiceProcessor class:

python
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](README.md) file in the repository.

Contributing
We welcome contributions! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more details on how to get started.

License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.