Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:0xsline OpenChatCut Speech To Text

From Leeroopedia
Knowledge Sources
Domains Transcription, NLP, Speech_Recognition
Last Updated 2026-10-22 14:00 GMT

Overview

Recognition principle that converts audio speech into text with word-level timestamps using either cloud AI providers (OpenAI, Deepgram, Groq, ElevenLabs, Cartesia) or local whisper.cpp models, normalizing diverse provider outputs into a uniform transcript structure.

Description

Speech-to-Text (ASR — Automatic Speech Recognition) transforms audio into structured text with timestamps. The principle covers two execution paths:

  • Cloud transcription: Uses the Vercel AI SDK `transcribe()` function with provider-specific SDK packages:
    • OpenAI (Whisper API)
    • Deepgram
    • Groq
    • ElevenLabs
    • Cartesia
    • Mistral (OpenAI-compatible)
  • Desktop (native) transcription: Uses whisper.cpp (ggml) via a persistent `whisper-server` process (model loaded once) with `whisper-cli` spawn as fallback.

Both paths produce a normalized `NormalizedTranscriptResult`:

  • text: Full transcript text (joined words with punctuation spacing).
  • words: Array of `NormalizedTranscriptWord` with `{ text, start (ms), end (ms), speaker }`.
  • utterances: Grouped by speaker — consecutive words with the same speaker ID form an utterance.

The normalization layer handles provider-specific output shapes:

  • OpenAI/Groq: `words[]` array with `start`/`end` in seconds.
  • Deepgram: `results.channels[0].alternatives[0].words[]`.
  • ElevenLabs/Cartesia: `words[]` with `type: 'word'` filter.
  • Fallback: `segments[]` with word grouping by standard AI SDK format.

Key parameters:

  • language: ISO code or `'auto'` for auto-detection.
  • diarize: Speaker diarization (Deepgram, ElevenLabs).
  • timestampGranularities: `['word']` for word-level timestamps.

Usage

Use this principle when:

  • Transcribing video/audio media for transcript-driven editing.
  • Generating word-level timestamps for caption/subtitle creation.
  • Supporting both cloud (API-based) and desktop (local whisper.cpp) transcription.

Theoretical Basis

The transcription pipeline:

# Abstract algorithm (NOT real implementation)
def transcribe(audio, provider, language, diarize):
    # Cloud path
    if provider in CLOUD_PROVIDERS:
        result = ai_sdk_transcribe(
            model=provider_model,
            audio=audio,
            provider_options={
                'language': language,
                'diarize': diarize,
                'timestamp_granularities': ['word'],
            },
        )
        words = normalize_provider_words(provider, result)
    # Desktop path
    else:
        words = whisper_cpp_transcribe(audio, model)

    # Normalize to uniform format
    return {
        'text': join_with_punctuation_spacing(words),
        'words': words,  # [{ text, start_ms, end_ms, speaker }]
        'utterances': group_by_speaker(words),
    }

Related Pages

Implemented By

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment