Test and compare Speech-to-Text APIs from Azure, Google Cloud, and AWS.
# Clone or navigate to the project directory
cd ~/Projects/stt-api-tester
# Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install the package
pip install -e .
# For development (includes test dependencies)
pip install -e ".[dev]"Copy the example environment file and fill in your credentials:
cp .env.example .envAzure Speech Services:
AZURE_SPEECH_KEY: Your Azure Speech service subscription keyAZURE_SPEECH_REGION: Azure region (e.g.,eastus,westus2)
Get credentials: Azure Portal → Create a Speech resource
Google Cloud Speech-to-Text:
GOOGLE_APPLICATION_CREDENTIALS: Path to your service account JSON key file
Get credentials: Google Cloud Console → APIs & Services → Credentials → Create Service Account
AWS Transcribe:
AWS_ACCESS_KEY_ID: Your AWS access key IDAWS_SECRET_ACCESS_KEY: Your AWS secret access keyAWS_REGION: AWS region (e.g.,us-east-1)
Get credentials: AWS IAM Console → Users → Security Credentials
Verify which providers are configured:
stt-test checkTranscribe using specific providers:
# Single provider
stt-test file audio.wav --providers azure
# Multiple providers
stt-test file audio.wav --providers azure,google,aws
# All configured providers (default)
stt-test file audio.wavRun the same audio through all configured providers and compare results:
stt-test compare audio.wavThis shows a side-by-side comparison with:
- Transcription text
- Confidence scores (when available)
- Latency measurements
Stream audio from your microphone:
# Record for 10 seconds (default)
stt-test stream --providers azure
# Record for custom duration
stt-test stream --duration 30
# Continuous mode (Ctrl+C to stop)
stt-test stream --duration 0Note: Streaming requires PyAudio, which may need system dependencies:
- macOS:
brew install portaudio - Ubuntu:
sudo apt-get install portaudio19-dev - Windows: Usually works out of the box
- WAV (recommended)
- MP3
- FLAC
For best results, use:
- Sample rate: 16000 Hz
- Channels: Mono
- Bit depth: 16-bit
Use the library programmatically:
from pathlib import Path
from stt_tester.providers import AzureSTTProvider, GoogleSTTProvider, AWSSTTProvider
from stt_tester.comparison import compare_providers, print_comparison
# Create providers
providers = [
AzureSTTProvider(),
GoogleSTTProvider(),
AWSSTTProvider(),
]
# Compare transcription results
audio_path = Path("audio.wav")
report = compare_providers(audio_path, providers)
# Print formatted results
print_comparison(report)
# Access individual results
for result in report.results:
if result.success:
print(f"{result.provider_name}: {result.transcription.text}")
print(f" Latency: {result.latency_seconds:.2f}s")# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run with coverage
pytest --cov=stt_testerstt-api-tester/
├── pyproject.toml # Project config with dependencies
├── README.md # This file
├── .env.example # Template for API credentials
├── stt_tester/
│ ├── __init__.py
│ ├── base.py # Abstract base class for providers
│ ├── providers/
│ │ ├── __init__.py
│ │ ├── azure_stt.py # Azure Speech Services
│ │ ├── google_stt.py # Google Cloud Speech-to-Text
│ │ └── aws_stt.py # AWS Transcribe
│ ├── audio.py # Audio file handling & streaming
│ ├── comparison.py # Compare results across providers
│ └── cli.py # Command-line interface
├── samples/ # Sample audio files for testing
└── tests/
└── test_providers.py # Unit tests
MIT