awvoice
Turn speech into text and text into speech, on a service you host.
pip install awvoice
from awvoice import VoiceClient
client = VoiceClient(
stt_url="http://localhost:5000/transcribe",
tts_url="http://localhost:5000/synthesize")
text = client.transcribe("voice.wav")
audio = client.synthesize("Hello, world!")
# Set endpoints via environment variables
export AWVOICE_STT_URL=http://localhost:5000/transcribe
export AWVOICE_TTS_URL=http://localhost:5000/synthesize
# Transcribe speech to text
awvoice transcribe voice.wav
awvoice transcribe voice.wav -o output.txt
# Synthesize text to speech
awvoice synthesize "Hello, world!" -o output.wav
How it works
awvoice is a client library for speech-to-text (STT) and text-to-speech (TTS) services that you host and control.
It does not call any external API or cloud service. Instead, you configure HTTP endpoints to your own services:
client = VoiceClient(
stt_url="http://your-stt-service.local:8000/transcribe",
tts_url="http://your-tts-service.local:8000/synthesize")
Service requirements
Speech-to-text service:
- Accepts
POSTrequest with audio bytes - Returns JSON with a
textfield:{"text": "transcribed text"}
Text-to-speech service:
- Accepts
POSTrequest with UTF-8 text bytes - Returns raw audio bytes (any format your service produces)
Configuration
Set endpoints via constructor arguments or environment variables:
# Via constructor
client = VoiceClient(
stt_url="http://localhost:5000/transcribe",
tts_url="http://localhost:5000/synthesize")
# Via environment variables
# export AWVOICE_STT_URL=http://localhost:5000/transcribe
# export AWVOICE_TTS_URL=http://localhost:5000/synthesize
client = VoiceClient()
Error handling
All errors are explicit and fail closed:
from awvoice import ServiceConfigError, ServiceError
try:
text = client.transcribe("voice.wav")
except ServiceConfigError as e:
# Service endpoint not configured
print(f"Configuration error: {e}")
except ServiceError as e:
# Service unreachable or returned error
print(f"Service error: {e}")
except FileNotFoundError as e:
# Audio file not found
print(f"File error: {e}")
Testing
# Run all tests
pip install -e ".[dev]"
pytest
# Run self-tests (no external service required)
awvoice --self-test
The aw family
Standalone tools you can adopt alone. Each replaces something you would otherwise have to trust with something you can check.
| tool | instead of trusting | you check |
|---|---|---|
| awdk | a framework's idea of how your agents should run | one loop you can read |
| awbac | that denied requests are denied | the exact reason for every decision |
| awvoice | a cloud API for speech | a service you host and control |
| awkno | that you remember the family | the ecosystem in your terminal, offline |
Apache-2.0.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file awvoice-0.1.0.tar.gz.
File metadata
- Download URL: awvoice-0.1.0.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4af6b179373e75cc756254f955f02fa52f7da218ee6b9d5b952f80d3531aa6e2
|
|
| MD5 |
598ce0c387e964d25fa66c20639790ee
|
|
| BLAKE2b-256 |
8306f7439586914d325a5f55cb5d45f92570951359bd633e194e934b8cf68cfd
|
File details
Details for the file awvoice-0.1.0-py3-none-any.whl.
File metadata
- Download URL: awvoice-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc1ab958023ad5a09f1cc4ec14fead6b37b3f3e847467dc52e9baa751137c7bd
|
|
| MD5 |
1bccb10de10608e3a80b8fff33ced284
|
|
| BLAKE2b-256 |
d548b4e8f66884fd8cdb57fa78314ef98a2e2abcca1850c330387df0e8f3d53d
|