Audio Library
This is a Python library for audio interface, including text-to-speech (TTS), speech-to-text (STT), audio playback, recording, and processing. It can be used in desktop apps, web apps, and provides a simple API for integration.
Features
- Text-to-speech conversion
- Speech-to-text conversion
- Audio playback
- Audio recording
- Audio processing
Installation
- Clone the repository:
git clone https://github.com/yourusername/audio-library.git
cd audio-library
- Build and run the Docker container:
docker-compose up --build
This will build the Docker image, install all dependencies (including PortAudio), and run the unit tests.
Usage
Here's an example of how to use the various features of the library:
from vocochat.audio.audio import AudioInterface
audio = AudioInterface()
# Text-to-speech example
text = "Hello, this is a test of the text-to-speech functionality."
audio_data = audio.text_to_speech(text)
audio.play_audio(audio_data)
# Speech-to-text example
print("Speak now...")
audio_data = audio.record_audio(duration=5)
text = audio.speech_to_text(audio_data)
print(f"You said: {text}")
# Audio processing example
processed_audio_data = audio.process_audio(audio_data)
audio.play_audio(processed_audio_data)
See the examples directory for more detailed usage examples.
API
AudioInterface
The main interface for the audio library.
text_to_speech(text)
Convert text to speech.
speech_to_text(audio_data)
Convert speech to text.
play_audio(audio_data)
Play audio data.
record_audio(duration)
Record audio from the microphone for the specified duration (in seconds).
process_audio(audio_data)
docker compose up --build
pip install pyaudio
sudo dnf install portaudio-devel redhat-rpm-config
pip install --user pyaudio
Process audio data (e.g., noise reduction, format conversion, etc.).
Contributing
Contributions are welcome! Please see the CONTRIBUTING.md file for guidelines.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for vocochat 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vocochat-0.1.2.tar.gz | 7.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vocochat-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / vocochat-0.1.2.tar.gz
| Download URL | vocochat-0.1.2.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3231c192d753f232cbc11402d7f877059e2ccc81fef2a300fcabf0cbc23742a
|
|
BLAKE2b-256 checksum How to use checksums |
e86e270b2e14ba1d1889d0d9a1d7e2121ebba6efbf2165fc3353ddeb384b94ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.3
|
Release files / vocochat-0.1.2-py3-none-any.whl
| Download URL | vocochat-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e70f592e511b21b10b069f1ccb076a2fadb64fd2cea525593b3f2c208f59638
|
|
BLAKE2b-256 checksum How to use checksums |
8e92a678462d6b3e46751d31aed195a5582e76d5a2b3a6482a8a6e4ca7faed11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.3
|