Whisper Flow Documentation

repository·main·Indexed 21 days ago

https://github.com/dimastatz/whisper-flow

A real-time transcription service built on OpenAI's Whisper model. It enables low-latency, streaming speech-to-text using a tumbling window approach to process PCM audio chunks (16 kHz, Mono, 16-bit signed integer). The project provides a FastAPI server with WebSocket and REST endpoints, a Python library via pip, and Docker deployment options. Key modules include whisperflow.transcriber for model loading and transcription, and whisperflow.streaming for managing transcription sessions.

Tokens
5.7K
Snippets
11
Records
33
Agent score
73%

What's inside Whisper Flow

  1. Overview of the Metavox multilingual narration workflow

    main

    Metavox is an automated service designed to translate and narrate video content into different languages. It is intended for content creators (e.g., YouTube bloggers) to expand international reach without manual dubbing.

    The service automates a four-step workflow:

    1. Extract and Transcribe Audio: Uses Speech-to-Text (STT) to convert original video audio into text.
    2. Translate Text: Uses Translation APIs to convert the transcribed text into target language(s).
    3. Generate Narration: Uses Text-to-Speech (TTS) to synthesize natural-sounding narration in the target language.
    4. Seamlessly Edit Video: Combines the new audio with original visuals, attempting to synchronize lip movement and maintain visual quality.

    Metavox supports both local video files and direct input from YouTube.

  2. Application ideas using WhisperFlow

    main

    WhisperFlow can be integrated with Large Language Models (LLMs) to automate complex tasks in various domains. Potential application architectures include:

    • Language Assessment (e.g., Linga): Use real-time transcription for conversation practice, analyze speech patterns/grammar for personalized feedback, and simulate standardized tests (TOEFL/IELTS) with immediate feedback.
    • Interactive Reading (e.g., LitMind): Combine Text-to-Speech (TTS) for narration with WhisperFlow's transcription to enable interactive Q&A sessions. The system can pause at natural breaks to engage users in discussions about themes or characters.
    • Video Localization (e.g., MetaVox): Automate the translation and narration of video content (like YouTube videos). The workflow involves transcribing the original audio, translating the text, generating new AI narration, and re-encoding the video.
    • Presentation Automation (e.g., SlideCrafter): Convert static slides (Google Slides/PowerPoint) into narrated video clips. Users can provide scripts via text or speech, which are then converted into AI-powered voiceovers synchronized with slide transitions.
  3. How Whisper Flow handles streaming transcription

    main

    Whisper Flow provides real-time transcription by receiving streaming media as a series of sequential data packets or 'chunks'. Unlike batch processing (where a full file is processed at once), Whisper Flow transcribes these chunks on the spot.

    To manage the stream, Whisper Flow uses a tumbling window technique, gathering events into segments until specific conditions are met. The transcription is returned as a series of events. Each event contains a segment of transcribed speech, and the service provides updates as the segment grows until it is complete.

    Each transcription event includes:

    • Transcript: The transcribed text.
    • EndTime: The timestamp of the segment.
    • IsPartial: A boolean indicating if the result is a partial transcription (True) or a finalized segment (False).
  4. Understand the Monetization Feedback Loop process

    main

    The Monetization Feedback Loop is a continuous, evidence-driven cycle used to find and grow revenue for WhisperFlow and its derivative products (Linga, LitMind, MetaVox, SlideCrafter). The process follows a fixed 2-week cadence and consists of four stages:

    1. PLAN: Form a falsifiable hypothesis. Define a segment, an offer, a value proposition, a primary metric, and a numeric target. Define the smallest possible test.
    2. DO: Run the smallest test possible. Prioritize "fake-door" tests (e.g., landing pages, "Buy" buttons) or manual-first delivery (concierge consulting) over building full features.
    3. MEASURE: Collect data and compare the primary metric against the target set during the PLAN phase.
    4. LEARN: Make an explicit decision to Keep/double down (target met), Pivot (partial signal), or Kill (no signal) the hypothesis. This decision seeds the next PLAN.

    Key Principles:

    • Run only 1–2 hypotheses at a time to ensure results are attributable.
    • A "no" (killing a bad bet) is considered a successful experiment if done cheaply.
    • Protect the open-source core by using community health as a guardrail metric.
  5. Use guardrail metrics to protect the open-source core

    main

    While pursuing monetization, use supporting or guardrail metrics to ensure you are not eroding the project's foundation or user experience. Recommended guardrail metrics include:

    • Activation rate: Users who reach their first transcription value.
    • Retention / churn: User stickiness.
    • Funnel drop-off: Identifying friction points in the visit → signup → activate → pay flow.
    • Cost to serve: Inference/compute cost per active user (critical for maintaining WhisperFlow's latency goals).
    • Community health: Monitoring stars, contributors, and issues to ensure monetization doesn't degrade the free experience.
  6. Understand the WhisperFlow VS Code extension architecture

    main

    The WhisperFlow VS Code extension is designed to stream microphone audio to a WhisperFlow server and insert transcripts directly into the editor.

    Key Architectural Decisions:

    • Sidecar Audio Capture: Instead of using a Webview (which steals focus from the editor), the extension uses a sidecar process to capture audio and pipe raw PCM over a WebSocket. This allows for 'dictate-at-cursor' functionality while the editor maintains focus. It also supports headless operation and Remote-SSH.
    • Separate Repository: The extension is maintained in a dedicated repository (whisper-flow-vscode) to avoid CI/CD conflicts, Docker build pollution, and accidental PyPI publishing of TypeScript code.
    • Protocol-Driven: Because the extension and server live in separate repos, they communicate via a versioned wire protocol contract. The extension performs a version handshake using GET /ready to compare protocol_version and prevent mismatches.
  7. WhisperFlow Product Development Guardrails

    main

    To maintain a part-time pace and avoid building before demand is proven, follow these build/refuse guidelines:

    Build (Phase B only):

    • API keys
    • Per-minute metering
    • Stripe billing
    • Landing page
    • Basic onboarding

    Refuse (Until pulled by a paying customer):

    • Dashboards
    • Multi-region support
    • New/larger ML models
    • Fancy UI
    • Full product apps (e.g., MetaVox, Linga, LitMind, SlideCrafter)
  8. Understand partial vs non-partial transcription results

    main

    Whisper-Flow provides two types of real-time transcription results to balance low latency with high accuracy:

    • Partial results: These appear immediately as you speak. They provide instant feedback based on the system's current predictions, even before a sentence is finished.
    • Non-partial results: These are the finalized transcriptions. Once the input is complete, Whisper-Flow refines and confirms the text to ensure higher accuracy.
  9. Handle non-monotonic partial transcripts

    main

    When implementing client-side insertion logic for WhisperFlow, you must account for the fact that partials are not monotonic.

    Whisper's partial results may rewrite previously emitted words as more context becomes available. To handle this correctly:

    1. Maintain a pending range in the editor.
    2. Replace the entire pending range with the new partial on every update.
    3. Never append partials to existing text.
    4. Only commit the text to the document when is_partial is false (indicating a final result).
  10. Deploy Whisper Flow using Docker

    main

    You can deploy Whisper Flow using the provided helper script or manually via Docker commands.

    Using the helper script

    Running ./run.sh -docker will stop/remove existing containers/images, build a fresh image, and run the container on port 8888.

    Manual Docker setup

    To run the container on port 8181 manually:

    1. Build the image using Dockerfile.test.
    2. Run the container in detached mode.
    3. Monitor logs or stop the container as needed.
    # Using the helper script (runs on port 8888)
    ./run.sh -docker
    
    # Manual Setup (runs on port 8181)
    # Build the image
    docker build -t whisperflow-image --file Dockerfile.test .
    
    # Run the container
    docker run --name whisperflow-container -p 8181:8181 -d whisperflow-image
    
    # Check logs
    docker logs whisperflow-container
    
    # Stop the container
    docker stop whisperflow-container
  11. WhisperFlow Business Strategy: 0 to Money Plan

    main

    WhisperFlow follows a phased strategy designed for a part-time solo founder (~10–15 hrs/week) to move from zero revenue to a sustainable business. The strategy avoids competing on raw transcription API scale and instead focuses on two unique selling points (USPs):

    1. Sub-500ms latency
    2. Self-hostable architecture (audio never leaves the customer's infrastructure)

    The plan uses a 'wedge' approach: starting with a fixed-price integration service (Cash bridge) to fund development and find design partners, followed by a thin hosted/self-hosted product.

    Core Milestones

    • M1: First paying customer (~Week 6): Achieved via a paid integration sprint, pilot, or prepaid design-partner slot.
    • M2: First $1k MRR (~Week 16): Achieved through recurring accounts (hosted usage + licenses).
    • M3: Ramen profitable (~Week 30–40): Achieved when recurring revenue covers your personal monthly burn ($Z).