Skip to main content

vocametrix-python

PyPI version Python versions CI License: MIT API docs

Official Python SDK for the Vocametrix API — voice analysis, speech therapy, and acoustic measurement for speech-language pathologists, voice researchers, and developers.

Get an API key

Vocametrix is a commercial API. You need an account to use this SDK.

  • Sign up — create an account and get your API key. New accounts include a free trial (5 minutes of analysis or 5 API credits, whichever comes first) so you can run the quickstart below without entering payment details.
  • Pricing — see plans and rates once your trial is used up.

Once you have a key, every call is one VOCAMETRIX_API_KEY env var away.

Install

pip install vocametrix

Requires Python ≥ 3.9.

30-second quickstart

export VOCAMETRIX_API_KEY="your-api-key-here"
from vocametrix import VocametrixClient

client = VocametrixClient()  # reads VOCAMETRIX_API_KEY from environment

# AVQI v03.01: a sustained vowel plus a connected speech recording
result = client.avqi.calculate(sustained_vowel="vowel.wav", connected_speech="speech.wav")
print(result["AVQI"])    # the cut-off depends on the language and text read
print(result["CPP"], result["HNR25"])

Authentication

Set the VOCAMETRIX_API_KEY environment variable, or pass it explicitly:

from vocametrix import VocametrixClient

# From env var (recommended — never hardcode keys)
client = VocametrixClient()

# Explicit key (e.g. loaded from a secrets manager)
client = VocametrixClient(api_key="va_...")

Never hardcode API keys in source code. Use environment variables or a secrets manager.

What's included

Namespace What it does
client.avqi AVQI dysphonia index (Maryn/Barsties)
client.dsi Dysphonia Severity Index
client.cpp Cepstral Peak Prominence
client.hnr Multi-band Harmonics-to-Noise Ratio
client.jitter_shimmer Jitter & shimmer (Teixeira & Gonçalves 2014)
client.vrp Vocal range (ambitus, F0 only, from a glissando)
client.pronunciation Pronunciation assessment (30+ locales)
client.transcription Async speech-to-text with SSE
client.tts Text-to-speech with per-character timing
client.phoneme Phoneme detection (French, Estonian)
client.stuttering Stuttering classification (async polling)
client.prosody Prosody similarity (model vs learner)
client.egemaps eGeMAPS 88-feature extraction
client.sound_level Sound level measurement (dB SPL)
client.advanced.measure_ddk Diadochokinesis (pa-ta-ka): syllable rate, regularity, acceleration, Pierce 2013 norms for 65-86

Workflows

Pronunciation assessment

result = client.pronunciation.assess(
    audio="recording.wav",
    reference_text="Hello, my name is Alex.",
    locale="en-US",
)
print(result["accuracyScore"], result["fluencyScore"])
for word in result.get("words", []):
    print(word["word"], word["accuracyScore"])

Batch AVQI over a folder

import pathlib

# Each patient folder holds vowel.wav and speech.wav
for patient in pathlib.Path("./recordings").iterdir():
    result = client.avqi.calculate(
        sustained_vowel=str(patient / "vowel.wav"),
        connected_speech=str(patient / "speech.wav"),
    )
    print(f"{patient.name}: AVQI={result['AVQI']:.2f}")

Async transcription with SSE

for event in client.transcription.stream("recording.wav", locale="en-US"):
    print(event.status, event.progress)
    if event.is_terminal_success:
        print("Transcript:", event.display_text)

Async client

import asyncio
from vocametrix import AsyncVocametrixClient

async def main():
    async with AsyncVocametrixClient() as client:
        result = await client._aget(
            "https://platform.vocametrix.com/api/calculate-avqi",
            params={"svFileId": "..."},
        )
        print(result)

asyncio.run(main())

Error handling

from vocametrix.exceptions import (
    VocametrixAuthError,       # 401 — bad or missing API key
    VocametrixRateLimitError,  # 429 — SDK retries automatically (up to 3×)
    VocametrixValidationError, # 422 — invalid parameter values
    VocametrixServerError,     # 5xx — SDK retries automatically
)

try:
    result = client.avqi.calculate(sustained_vowel="vowel.wav", connected_speech="speech.wav")
except VocametrixRateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except VocametrixAuthError:
    print("Check your API key at https://www.vocametrix.com/registration")

The SDK retries 429, 500, 502, 503, 504 with exponential backoff (up to 3 retries). Non-retriable errors (4xx except 429) raise immediately.

Longer examples

See vocametrix-examples for:

  • End-to-end workflow scripts (batch pronunciation, full voice assessment, prosody loops)
  • Jupyter notebooks with cohort visualizations

API reference

The Vocametrix ecosystem:

  • 📘 Vocametrix API documentation — full reference for all 48 endpoints (clinical voice quality, pronunciation assessment, speech-to-text, phoneme detection, prosody similarity, eGeMAPS feature extraction, and more).
  • 📐 OpenAPI 3.1 specification — machine-readable API schema. Generate clients in any language.
  • 🟦 vocametrix-js — official TypeScript / JavaScript SDK (npm install vocametrix).
  • 🤖 vocametrix-mcp — official MCP server for Claude, Cursor, Zed, Windsurf, and any MCP-compatible agent.

Contributing

git clone https://github.com/pmarmaroli/vocametrix-python
cd vocametrix-python
pip install -e ".[dev]"

# Regenerate the low-level client from the live OpenAPI spec
python tasks.py regenerate

# Run unit tests (no API key needed — all mocked)
pytest tests/unit/

# Run integration tests (real API calls — requires VOCAMETRIX_TEST_API_KEY)
pytest tests/integration/

The src/vocametrix/_generated/ directory is auto-generated. Do not edit it manually. All hand-written logic lives in src/vocametrix/client.py, _namespaces.py, _http.py, and exceptions.py.

License

The vocametrix SDK is released under the MIT License. You're free to use, modify, and redistribute the SDK source code.

Calling the Vocametrix API with this SDK requires an API key, which is issued with a paid Vocametrix account. The SDK code is free; the service is not. See pricing.

Metadata

Release files for vocametrix 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vocametrix 0.5.1
File Size Uploaded Provenance Actions
vocametrix-0.5.1.tar.gz 110.6 kB With provenance Details for vocametrix-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vocametrix 0.5.1
File Interpreter ABI Platform Actions
vocametrix-0.5.1-py3-none-any.whl Python 3 none any Details for vocametrix-0.5.1-py3-none-any.whl

Total release size: 378.7 kB

Release files / vocametrix-0.5.1.tar.gz

Download URL vocametrix-0.5.1.tar.gz
Size 110.6 kB
Tags Source
SHA-256 checksum
How to use checksums
026aa24a349a4fdf3f2ce28e9b57ac85b0f4a75e5f83a5af7959f49a7b525471
BLAKE2b-256 checksum
How to use checksums
0d31746441b05a7563aaa7150b02d651c2b308fa444a417dd931c7397d0f8ab2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / vocametrix-0.5.1-py3-none-any.whl

Download URL vocametrix-0.5.1-py3-none-any.whl
Size 268.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8282c307cd9bc7f047d1ad8f2bf981a6307732d2bd53040a687f821bc7ae23a6
BLAKE2b-256 checksum
How to use checksums
f4ea04e325de2f97a517983baf9497e09b9b3883977424041d1416c8680a3569
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for vocametrix 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vocametrix-0.5.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page