Skip to main content

ASRX Logo

ASRX: Universal Forced Alignment & Speech Segmentation

ASRX is a high-performance, model-agnostic Forced Alignment, VAD Segmentation, and Speaker Diarization engine.

It allows developers to take text generated by ANY external ASR model, LLM, or API (e.g. Cohere, Qwen, Whisper, vLLM, OpenAI, Deepgram, or custom local scripts) and immediately generate:

  • ⏱️ Exact millisecond-level word timestamps (start, end)
  • 🎯 Word-level confidence scores
  • 🎙️ VAD-guided natural speech segment grouping
  • 👥 Speaker Diarization
  • Ultra-fast processing

🚀 Quickstart

1. Installation

ASRX uses a lazy-loaded backend architecture. You only install the heavy ML dependencies for the specific models you want to use.

# Core installation (fast, no heavy dependencies)
pip install -e asrx

# 1. Install for Wav2Vec2/MMS alignment (Recommended)
pip install -e asrx[transformers]

# 2. Install for Pyannote VAD and Diarization
pip install -e asrx[pyannote]

# 3. Install for NVIDIA NeMo (Aligner, VAD, Sortformer)
pip install -e asrx[nemo]

# 4. Install for CTC-Segmentation (Confidence scores)
pip install -e asrx[ctc,transformers]

2. Standalone Alignment in 1 Line (asrx.align)

import asrx

audio_file = "meeting.wav"
my_text = "I don't have a problem with where we go, the most important thing is that the place is quiet, has good coffee, and we can sit comfortably and talk."

# Generates word timestamps, confidence scores, and VAD-guided segments
result = asrx.align(
    audio=audio_file,
    text=my_text,
    language="en",
    aligner="wav2vec2", # "wav2vec2", "mms", "nemo", "ctc_segmentation"
    vad="silero"        # "silero", "pyannote", "nemo", "flashvad"
)

print("Total words aligned:", len(result["word_segments"]))
print("First word timestamp:", result["word_segments"][0])

🧰 Backend Registry

Because ASRX is entirely modular, you can mix and match the best tools for your specific use case.

Alignment Backends (aligner=...)

Key Description Pros Install Required
"wav2vec2" HuggingFace Wav2Vec2 (Default) Fast, built-in dicts for 40 langs transformers
"mms" Meta MMS (1B params) Supports 1,107+ languages transformers
"nemo" NVIDIA NeMo Forced Aligner Viterbi CTC, highly optimized nemo_toolkit[asr]
"ctc_segmentation" CTC-Segmentation Algorithm Provides per-word confidence flags ctc-segmentation

VAD Backends (vad=...)

Key Description Pros Install Required
"silero" Silero VAD (Default) Fast, works out of the box (Torch Hub) None
"pyannote" Pyannote VAD Best accuracy in noise pyannote.audio
"nemo" NVIDIA MarbleNet Fast and accurate nemo_toolkit[asr]
"flashvad" FlashVAD Ultra-lightweight (~46K params) flashvad

Diarization Backends (diarize=...)

Key Description Pros Install Required
"pyannote" Pyannote Diarization (Default) Industry standard, clustering pyannote.audio
"sortformer" NVIDIA NeMo Sortformer SOTA for overlapping speech nemo_toolkit[asr]

🛠️ Advanced Usage

1. Alignment with SOTA Diarization (NeMo Sortformer)

import asrx

result = asrx.align(
    audio="panel_discussion.wav",
    text=transcript_text,
    language="en",
    vad="nemo",
    diarize="sortformer"
)

# Words and segments will have "SPEAKER_00", "SPEAKER_01", etc.
for seg in result["segments"]:
    print(f"[{seg['speaker']}] {seg['start']}s -> {seg['end']}s: {seg['text']}")

2. Custom Pyannote Models (e.g., Community-1)

result = asrx.align(
    audio="audio.wav",
    text=my_text,
    language="ar",
    diarize="pyannote",
    model_name="pyannote/speaker-diarization-community-1",
    hf_token="your_hf_token"
)

3. Reusable Pipeline for High-Throughput Batching

import asrx

# Load pipeline once into memory
pipeline = asrx.load_aligner(
    language="en",
    aligner="mms",
    vad="pyannote",
    diarize="sortformer",
    device="cuda",
    hf_token="your_hf_token"
)

# Process multiple audio files efficiently
for audio_path, text in dataset:
    result = pipeline.align(audio=audio_path, text=text)

📊 Standardized JSON Output

{
  "segments": [
    {
      "start": 0.12,
      "end": 7.15,
      "text": "I don't have a problem with where we go, the most important thing is that the place is quiet.",
      "speaker": "SPEAKER_00",
      "words": [
        {
          "word": "I",
          "start": 0.12,
          "end": 0.34,
          "score": 0.769,
          "speaker": "SPEAKER_00"
        },
        {
          "word": "don't",
          "start": 0.381,
          "end": 0.461,
          "score": 0.976,
          "speaker": "SPEAKER_00"
        }
      ]
    }
  ],
  "word_segments": [
    {
      "word": "I",
      "start": 0.12,
      "end": 0.34,
      "score": 0.769,
      "speaker": "SPEAKER_00"
    },
    {
      "word": "don't",
      "start": 0.381,
      "end": 0.461,
      "score": 0.976,
      "speaker": "SPEAKER_00"
    }
  ],
  "language": "en"
}

🌍 Supported Alignment Languages

Supports Arabic (ar), English (en), French (fr), German (de), Spanish (es), Italian (it), Japanese (ja), Chinese (zh), Portuguese (pt), Russian (ru), Turkish (tr), Hindi (hi), Korean (ko), and 1000+ other languages via MMS and Multilingual models.


📄 License

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

asrx-0.3.2.tar.gz (48.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asrx-0.3.2-py3-none-any.whl (56.3 kB view details)

Uploaded Python 3

File details

Details for the file asrx-0.3.2.tar.gz.

File metadata

  • Download URL: asrx-0.3.2.tar.gz
  • Upload date:
  • Size: 48.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for asrx-0.3.2.tar.gz
Algorithm Hash digest
SHA256 2ec9d7d1c2f6da58a7300b2e99d0df2ddabb44eb06e9824399ec64011904a167
MD5 3217bb2fd99222632c243571833db03d
BLAKE2b-256 75aade467845cbff172ea88e1c30ba94ea4c75e9026ff5195154deb3ab0ff639

See more details on using hashes here.

Provenance

The following attestation bundles were made for asrx-0.3.2.tar.gz:

Publisher: publish.yml on ahmed-eladl/asrx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file asrx-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: asrx-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 56.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for asrx-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8370baccd41c2785df1739ce795411f44edf1c4f9ffa1005a2c561ded622c951
MD5 c28f5dd88366b5c8b517671fea518352
BLAKE2b-256 4ed91060e8dec54e0b12cbe916507a648e76e531d756a8234ece1398dcee1c04

See more details on using hashes here.

Provenance

The following attestation bundles were made for asrx-0.3.2-py3-none-any.whl:

Publisher: publish.yml on ahmed-eladl/asrx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 files

0.3.1

2 files

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