# ufal/simulstreaming architecture

> Architecture diagram of the GitHub repository ufal/simulstreaming, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ufal/simulstreaming
- Repository: https://github.com/ufal/simulstreaming

## Overview

SimulStreaming processes audio incrementally through Whisper and can either emit direct speech translation or feed recognized text to an LLM translation stage. File simulation and socket servers expose the streaming workflows; the README also documents multilingual transcription, prompting/context, optional voice-activity control, and cascade translation. Edges reflect README statements and source-index references; unsampled subsystem internals and runtime links are omitted where their callers are not shown.

Main entry points: [`simulstreaming/whisper/simul_whisper/simul_whisper.py`](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/simul_whisper.py) (SimulWhisper ASR), [`simulstreaming_translate.py`](https://github.com/ufal/simulstreaming/blob/main/simulstreaming_translate.py) (Translation workflow), [`simulstreaming_whisper.py`](https://github.com/ufal/simulstreaming/blob/main/simulstreaming_whisper.py) (Whisper simulation), [`simulstreaming/whisper/whisper_streaming/whisper_online_main.py`](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/whisper_streaming/whisper_online_main.py) (Online processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_whisper["Streaming ASR"]
  node_whisper_online["Online processing"]
  node_vac["Voice activity control"]
  node_whisper_asr["SimulWhisper ASR<br/>[simul_whisper.py]"]
  node_whisper_config["Alignment configuration<br/>[config.py]"]
end

subgraph group_engine["Whisper Engine"]
  node_audio_features["Audio features<br/>[audio.py]"]
  node_whisper_model["Whisper model<br/>[model.py]"]
  node_decoding["Token decoding<br/>[decoding.py]"]
  node_tokenizer["Language tokenizer<br/>[tokenizer.py]"]
  node_timing["Word timing<br/>[timing.py]"]
  node_transcribe["Whisper transcription<br/>[transcribe.py]"]
end

subgraph group_translation["LLM Translation"]
  node_translate_entry["Translation workflow"]
  node_llm["LLM translation"]
  node_text_buffer["Context buffer"]
  node_segmenter["Sentence segmentation"]
  node_hovercraft["Streaming policy<br/>[hovercraft.py]"]
end

subgraph group_interfaces["Runtime Interfaces"]
  node_whisper_sim["Whisper simulation"]
  node_whisper_server["Whisper server<br/>[whisper_server.py]"]
  node_translate_server["Translation server"]
  node_connection["Socket connection<br/>[server_utils.py]"]
  node_line_packet["Line transport<br/>[line_packet.py]"]
end

node_audio_user(("Audio input"))
node_text_user(("Text input"))

node_audio_user -->|"provides audio"| node_whisper_sim
node_whisper_sim -->|"runs simulation"| node_whisper_online
node_whisper_sim -->|"configures ASR"| node_whisper_asr
node_whisper_sim -->|"sets options"| node_whisper_config
node_whisper_online -->|"uses controller"| node_vac
node_whisper_online -.->|"processes audio"| node_whisper_asr
node_whisper_asr -->|"extracts features"| node_audio_features
node_whisper_asr -.->|"runs inference"| node_whisper_model
node_whisper_asr -->|"decodes tokens"| node_decoding
node_whisper_asr -->|"tokenizes output"| node_tokenizer
node_whisper_asr -->|"aligns words"| node_timing
node_transcribe -->|"creates spectrogram"| node_audio_features
node_decoding -->|"runs forward pass"| node_whisper_model
node_decoding -->|"uses tokens"| node_tokenizer
node_whisper_server -->|"dispatches processing"| node_whisper_online
node_whisper_server -->|"uses connection"| node_connection
node_text_user -.->|"provides source text"| node_translate_entry
node_translate_entry -.->|"translates text"| node_llm
node_translate_entry -.->|"manages context"| node_text_buffer
node_translate_entry -->|"uses segmentation"| node_segmenter
node_translate_entry -->|"uses policy"| node_hovercraft
node_whisper_asr -.->|"supplies recognized text"| node_translate_entry
node_translate_server -->|"runs workflow"| node_translate_entry
node_translate_server -->|"uses connection"| node_connection
node_whisper_server -->|"uses connection"| node_connection
node_connection -->|"sends lines"| node_line_packet

click node_whisper_sim "https://github.com/ufal/simulstreaming/blob/main/simulstreaming_whisper.py"
click node_whisper_online "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/whisper_streaming/whisper_online_main.py"
click node_vac "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/whisper_streaming/vac_online_processor.py"
click node_whisper_server "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/whisper_streaming/whisper_server.py"
click node_whisper_asr "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/simul_whisper.py"
click node_whisper_config "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/config.py"
click node_audio_features "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/whisper/audio.py"
click node_whisper_model "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/whisper/model.py"
click node_decoding "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/whisper/decoding.py"
click node_tokenizer "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/whisper/tokenizer.py"
click node_timing "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/whisper/timing.py"
click node_transcribe "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/whisper/transcribe.py"
click node_translate_server "https://github.com/ufal/simulstreaming/blob/main/simulstreaming_translate_server.py"
click node_translate_entry "https://github.com/ufal/simulstreaming/blob/main/simulstreaming_translate.py"
click node_llm "https://github.com/ufal/simulstreaming/blob/main/simulstreaming_translate.py"
click node_text_buffer "https://github.com/ufal/simulstreaming/blob/main/simulstreaming_translate.py"
click node_segmenter "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/translate/sentence_segmenter.py"
click node_hovercraft "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/translate/hovercraft.py"
click node_connection "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/utils/server_utils.py"
click node_line_packet "https://github.com/ufal/simulstreaming/blob/main/simulstreaming/utils/line_packet.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_whisper_online,node_vac,node_whisper_asr,node_whisper_config toneBlue
class node_audio_features,node_whisper_model,node_decoding,node_tokenizer,node_timing,node_transcribe toneAmber
class node_translate_entry,node_llm,node_text_buffer,node_segmenter,node_hovercraft toneMint
class node_whisper_sim,node_whisper_server,node_translate_server,node_connection,node_line_packet toneRose
class node_audio_user,node_text_user toneIndigo
```

## Components

### Streaming ASR

- [Online processing](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/whisper_streaming/whisper_online_main.py): `simulstreaming/whisper/whisper_streaming/whisper_online_main.py`
- [Voice activity control](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/whisper_streaming/vac_online_processor.py): `simulstreaming/whisper/whisper_streaming/vac_online_processor.py`
- [SimulWhisper ASR](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/simul_whisper.py): `simulstreaming/whisper/simul_whisper/simul_whisper.py`
- [Alignment configuration](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/config.py): `simulstreaming/whisper/simul_whisper/config.py`

### Whisper Engine

- [Audio features](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/whisper/audio.py): `simulstreaming/whisper/simul_whisper/whisper/audio.py`
- [Whisper model](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/whisper/model.py): `simulstreaming/whisper/simul_whisper/whisper/model.py`
- [Token decoding](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/whisper/decoding.py): `simulstreaming/whisper/simul_whisper/whisper/decoding.py`
- [Language tokenizer](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/whisper/tokenizer.py): `simulstreaming/whisper/simul_whisper/whisper/tokenizer.py`
- [Word timing](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/whisper/timing.py): `simulstreaming/whisper/simul_whisper/whisper/timing.py`
- [Whisper transcription](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/simul_whisper/whisper/transcribe.py): `simulstreaming/whisper/simul_whisper/whisper/transcribe.py`

### LLM Translation

- [Translation workflow](https://github.com/ufal/simulstreaming/blob/main/simulstreaming_translate.py): `simulstreaming_translate.py`
- [LLM translation](https://github.com/ufal/simulstreaming/blob/main/simulstreaming_translate.py): `simulstreaming_translate.py`
- [Context buffer](https://github.com/ufal/simulstreaming/blob/main/simulstreaming_translate.py): `simulstreaming_translate.py`
- [Sentence segmentation](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/translate/sentence_segmenter.py): `simulstreaming/translate/sentence_segmenter.py`
- [Streaming policy](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/translate/hovercraft.py): `simulstreaming/translate/hovercraft.py`

### Runtime Interfaces

- [Whisper simulation](https://github.com/ufal/simulstreaming/blob/main/simulstreaming_whisper.py): `simulstreaming_whisper.py`
- [Whisper server](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/whisper/whisper_streaming/whisper_server.py): `simulstreaming/whisper/whisper_streaming/whisper_server.py`
- [Translation server](https://github.com/ufal/simulstreaming/blob/main/simulstreaming_translate_server.py): `simulstreaming_translate_server.py`
- [Socket connection](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/utils/server_utils.py): `simulstreaming/utils/server_utils.py`
- [Line transport](https://github.com/ufal/simulstreaming/blob/main/simulstreaming/utils/line_packet.py): `simulstreaming/utils/line_packet.py`

### Other components

- **Audio input**
- **Text input**

## Connections

- Audio input → Whisper simulation: provides audio (evidence: `README.md`)
- Whisper simulation → Online processing: runs simulation (evidence: `simulstreaming_whisper.py`)
- Whisper simulation → SimulWhisper ASR: configures ASR (evidence: `simulstreaming_whisper.py`)
- Whisper simulation → Alignment configuration: sets options (evidence: `simulstreaming_whisper.py`)
- Online processing → Voice activity control: uses controller (evidence: `simulstreaming/whisper/whisper_streaming/vac_online_processor.py`)
- Online processing → SimulWhisper ASR: processes audio
- SimulWhisper ASR → Audio features: extracts features (evidence: `simulstreaming/whisper/simul_whisper/simul_whisper.py`)
- SimulWhisper ASR → Whisper model: runs inference
- SimulWhisper ASR → Token decoding: decodes tokens (evidence: `simulstreaming/whisper/simul_whisper/simul_whisper.py`)
- SimulWhisper ASR → Language tokenizer: tokenizes output (evidence: `simulstreaming/whisper/simul_whisper/simul_whisper.py`)
- SimulWhisper ASR → Word timing: aligns words (evidence: `simulstreaming/whisper/simul_whisper/simul_whisper.py`)
- Whisper transcription → Audio features: creates spectrogram (evidence: `simulstreaming/whisper/simul_whisper/whisper/transcribe.py`)
- Token decoding → Whisper model: runs forward pass (evidence: `simulstreaming/whisper/simul_whisper/whisper/decoding.py`)
- Token decoding → Language tokenizer: uses tokens (evidence: `simulstreaming/whisper/simul_whisper/whisper/decoding.py`)
- Whisper server → Online processing: dispatches processing (evidence: `simulstreaming/whisper/whisper_streaming/whisper_server.py`)
- Whisper server → Socket connection: uses connection (evidence: `simulstreaming/whisper/whisper_streaming/whisper_server.py`)
- Text input → Translation workflow: provides source text
- Translation workflow → LLM translation: translates text (evidence: `simulstreaming_translate.py`)
- Translation workflow → Context buffer: manages context (evidence: `simulstreaming_translate.py`)
- Translation workflow → Sentence segmentation: uses segmentation (evidence: `simulstreaming_translate.py`)
- Translation workflow → Streaming policy: uses policy (evidence: `simulstreaming_translate.py`)
- SimulWhisper ASR → Translation workflow: supplies recognized text (evidence: `README.md`)
- Translation server → Translation workflow: runs workflow (evidence: `simulstreaming_translate_server.py`)
- Translation server → Socket connection: uses connection (evidence: `simulstreaming_translate_server.py`)
- Whisper server → Socket connection: uses connection (evidence: `simulstreaming/whisper/whisper_streaming/whisper_server.py`)
- Socket connection → Line transport: sends lines (evidence: `simulstreaming/utils/server_utils.py`)
