Skip to content

About

Test and compare Speech-to-Text APIs from Azure, Google Cloud, and AWS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STT API Tester

Test and compare Speech-to-Text APIs from Azure, Google Cloud, and AWS.

Installation

# 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]"

Configuration

Copy the example environment file and fill in your credentials:

cp .env.example .env

Required Credentials

Azure Speech Services:

  • AZURE_SPEECH_KEY: Your Azure Speech service subscription key
  • AZURE_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 ID
  • AWS_SECRET_ACCESS_KEY: Your AWS secret access key
  • AWS_REGION: AWS region (e.g., us-east-1)

Get credentials: AWS IAM Console → Users → Security Credentials

Usage

Check Configuration

Verify which providers are configured:

stt-test check

Transcribe a File

Transcribe 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.wav

Compare Providers

Run the same audio through all configured providers and compare results:

stt-test compare audio.wav

This shows a side-by-side comparison with:

  • Transcription text
  • Confidence scores (when available)
  • Latency measurements

Real-time Streaming

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 0

Note: 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

Supported Audio Formats

  • WAV (recommended)
  • MP3
  • FLAC

For best results, use:

  • Sample rate: 16000 Hz
  • Channels: Mono
  • Bit depth: 16-bit

Python API

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")

Running Tests

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run with coverage
pytest --cov=stt_tester

Project Structure

stt-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

License

MIT

About

Test and compare Speech-to-Text APIs from Azure, Google Cloud, and AWS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages