# toplib/openatc architecture

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

- Interactive diagram: https://gitdiagram.com/toplib/openatc
- Repository: https://github.com/toplib/openatc

## Overview

OpenATC is an ATC communication-training simulator, not a general chatbot: the documented goal is to simulate procedures while AI handles natural-language interpretation and pilot responses. The principal runtime path captures speech, segments it with voice activity detection, transcribes it, validates/corrects the phrase, generates a pilot reply and speech-ready wording, then plays synthesized audio. The GUI exposes ATC and pilot modes plus model, settings, tutorial, and documentation pages, though several actions are placeholders. Edges follow the sampled pipeline and shell wiring; the README describes simulation intent but no separate scenario-simulation implementation is evidenced here.

Main entry points: [`src/gui/shell/AppShell.cpp`](https://github.com/toplib/openatc/blob/master/src/gui/shell/AppShell.cpp) (Application Shell), [`src/core/pipeline/microphone/MicrophonePipeline.cpp`](https://github.com/toplib/openatc/blob/master/src/core/pipeline/microphone/MicrophonePipeline.cpp) (Microphone VAD), [`src/core/pipeline/ATCPipeline.cpp`](https://github.com/toplib/openatc/blob/master/src/core/pipeline/ATCPipeline.cpp) (ATC Orchestrator), [`src/core/microphone/Microphone.cpp`](https://github.com/toplib/openatc/blob/master/src/core/microphone/Microphone.cpp) (Microphone Input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Speech Capture"]
  node_microphone_pipeline["Microphone VAD"]
  node_microphone["Microphone Input<br/>[Microphone.cpp]"]
  node_audio_data["Audio Buffer"]
end

subgraph group_conversation["ATC Conversation"]
  node_whisper["Speech Recognition<br/>[WhisperBackend.cpp]"]
  node_atc_pipeline["ATC Orchestrator<br/>[ATCPipeline.cpp]"]
  node_llm_backend["LLM Interface<br/>[ILLMBackend.h]"]
  node_llama["Llama.cpp Backend"]
end

subgraph group_audio["Speech Output"]
  node_tts["Speech Synthesis"]
  node_openal["Audio Playback<br/>[OpenALBackend.cpp]"]
end

subgraph group_interface["Application Interface"]
  node_gui_entry["GUI Startup<br/>[main.cpp]"]
  node_manager["GUI Manager<br/>[Manager.cpp]"]
  node_home["Home Window<br/>[HomeWindow.h]"]
  node_app_shell["Application Shell<br/>[AppShell.cpp]"]
  node_activity_page["Activity Page<br/>[ActivityPage.cpp]"]
  node_content_pages["Mode And Hub Pages<br/>[ContentPages.cpp]"]
  node_settings_page["Settings Page<br/>[SettingsPage.cpp]"]
  node_header["Navigation Header<br/>[AppHeader.cpp]"]
  node_sidebar["Project Sidebar<br/>[ProjectSidebar.cpp]"]
  node_footer["Status Footer<br/>[StatusFooter.h]"]
end

subgraph group_integration["Model Access"]
  node_huggingface["Hugging Face Client<br/>[HuggingFace.cpp]"]
  node_http["HTTP Client<br/>[HttpClient.cpp]"]
end

node_user(("Controller"))
node_pilot_voice(("Pilot Voice"))

node_microphone_pipeline -->|"starts capture"| node_microphone
node_microphone -->|"buffers samples"| node_audio_data
node_audio_data -->|"reads samples"| node_microphone_pipeline
node_microphone_pipeline -->|"provides speech"| node_whisper
node_user -.->|"speaks into"| node_microphone
node_whisper -->|"transcribed text"| node_atc_pipeline
node_atc_pipeline -->|"requests responses"| node_llm_backend
node_llm_backend -->|"implemented by"| node_llama
node_atc_pipeline -->|"returns speech text"| node_tts
node_tts -->|"sends audio"| node_openal
node_openal -->|"plays response"| node_pilot_voice
node_gui_entry -->|"creates window"| node_home
node_home -->|"hosts shell"| node_app_shell
node_manager -.->|"routes settings"| node_app_shell
node_app_shell -->|"registers page"| node_activity_page
node_app_shell -->|"registers pages"| node_content_pages
node_app_shell -->|"registers page"| node_settings_page
node_app_shell -->|"connects navigation"| node_header
node_app_shell -->|"connects projects"| node_sidebar
node_app_shell -->|"creates footer"| node_footer
node_huggingface -->|"uses HTTP"| node_http

click node_microphone_pipeline "https://github.com/toplib/openatc/blob/master/src/core/pipeline/microphone/MicrophonePipeline.cpp"
click node_microphone "https://github.com/toplib/openatc/blob/master/src/core/microphone/Microphone.cpp"
click node_audio_data "https://github.com/toplib/openatc/blob/master/src/core/microphone/MicrophoneInputAudioData.h"
click node_whisper "https://github.com/toplib/openatc/blob/master/src/ai/stt/Whisper/WhisperBackend.cpp"
click node_atc_pipeline "https://github.com/toplib/openatc/blob/master/src/core/pipeline/ATCPipeline.cpp"
click node_llm_backend "https://github.com/toplib/openatc/blob/master/src/ai/llm/ILLMBackend.h"
click node_llama "https://github.com/toplib/openatc/blob/master/src/ai/llm/llamacpp/LlamacppBackend.cpp"
click node_tts "https://github.com/toplib/openatc/blob/master/src/ai/tts/SherpaOnnx/SherpaOnnxBackend.cpp"
click node_openal "https://github.com/toplib/openatc/blob/master/src/core/audio/OpenAL/OpenALBackend.cpp"
click node_gui_entry "https://github.com/toplib/openatc/blob/master/src/main.cpp"
click node_manager "https://github.com/toplib/openatc/blob/master/src/gui/Manager.cpp"
click node_home "https://github.com/toplib/openatc/blob/master/src/gui/home/HomeWindow.h"
click node_app_shell "https://github.com/toplib/openatc/blob/master/src/gui/shell/AppShell.cpp"
click node_activity_page "https://github.com/toplib/openatc/blob/master/src/gui/pages/ActivityPage.cpp"
click node_content_pages "https://github.com/toplib/openatc/blob/master/src/gui/pages/ContentPages.cpp"
click node_settings_page "https://github.com/toplib/openatc/blob/master/src/gui/pages/SettingsPage.cpp"
click node_header "https://github.com/toplib/openatc/blob/master/src/gui/widgets/AppHeader.cpp"
click node_sidebar "https://github.com/toplib/openatc/blob/master/src/gui/widgets/ProjectSidebar.cpp"
click node_footer "https://github.com/toplib/openatc/blob/master/src/gui/widgets/StatusFooter.h"
click node_huggingface "https://github.com/toplib/openatc/blob/master/src/clients/huggingface/HuggingFace.cpp"
click node_http "https://github.com/toplib/openatc/blob/master/src/core/net/HttpClient.cpp"

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_microphone_pipeline,node_microphone,node_audio_data toneBlue
class node_whisper,node_atc_pipeline,node_llm_backend,node_llama toneAmber
class node_tts,node_openal toneMint
class node_gui_entry,node_manager,node_home,node_app_shell,node_activity_page,node_content_pages,node_settings_page,node_header,node_sidebar,node_footer toneRose
class node_huggingface,node_http,node_user,node_pilot_voice toneIndigo
```

## Components

### Speech Capture

- [Microphone VAD](https://github.com/toplib/openatc/blob/master/src/core/pipeline/microphone/MicrophonePipeline.cpp): `src/core/pipeline/microphone/MicrophonePipeline.cpp`
- [Microphone Input](https://github.com/toplib/openatc/blob/master/src/core/microphone/Microphone.cpp): `src/core/microphone/Microphone.cpp`
- [Audio Buffer](https://github.com/toplib/openatc/blob/master/src/core/microphone/MicrophoneInputAudioData.h): `src/core/microphone/MicrophoneInputAudioData.h`

### ATC Conversation

- [Speech Recognition](https://github.com/toplib/openatc/blob/master/src/ai/stt/Whisper/WhisperBackend.cpp): `src/ai/stt/Whisper/WhisperBackend.cpp`
- [ATC Orchestrator](https://github.com/toplib/openatc/blob/master/src/core/pipeline/ATCPipeline.cpp): `src/core/pipeline/ATCPipeline.cpp`
- [LLM Interface](https://github.com/toplib/openatc/blob/master/src/ai/llm/ILLMBackend.h): `src/ai/llm/ILLMBackend.h`
- [Llama.cpp Backend](https://github.com/toplib/openatc/blob/master/src/ai/llm/llamacpp/LlamacppBackend.cpp): `src/ai/llm/llamacpp/LlamacppBackend.cpp`

### Speech Output

- [Speech Synthesis](https://github.com/toplib/openatc/blob/master/src/ai/tts/SherpaOnnx/SherpaOnnxBackend.cpp): `src/ai/tts/SherpaOnnx/SherpaOnnxBackend.cpp`
- [Audio Playback](https://github.com/toplib/openatc/blob/master/src/core/audio/OpenAL/OpenALBackend.cpp): `src/core/audio/OpenAL/OpenALBackend.cpp`

### Application Interface

- [GUI Startup](https://github.com/toplib/openatc/blob/master/src/main.cpp): `src/main.cpp`
- [GUI Manager](https://github.com/toplib/openatc/blob/master/src/gui/Manager.cpp): `src/gui/Manager.cpp`
- [Home Window](https://github.com/toplib/openatc/blob/master/src/gui/home/HomeWindow.h): `src/gui/home/HomeWindow.h`
- [Application Shell](https://github.com/toplib/openatc/blob/master/src/gui/shell/AppShell.cpp): `src/gui/shell/AppShell.cpp`
- [Activity Page](https://github.com/toplib/openatc/blob/master/src/gui/pages/ActivityPage.cpp): `src/gui/pages/ActivityPage.cpp`
- [Mode And Hub Pages](https://github.com/toplib/openatc/blob/master/src/gui/pages/ContentPages.cpp): `src/gui/pages/ContentPages.cpp`
- [Settings Page](https://github.com/toplib/openatc/blob/master/src/gui/pages/SettingsPage.cpp): `src/gui/pages/SettingsPage.cpp`
- [Navigation Header](https://github.com/toplib/openatc/blob/master/src/gui/widgets/AppHeader.cpp): `src/gui/widgets/AppHeader.cpp`
- [Project Sidebar](https://github.com/toplib/openatc/blob/master/src/gui/widgets/ProjectSidebar.cpp): `src/gui/widgets/ProjectSidebar.cpp`
- [Status Footer](https://github.com/toplib/openatc/blob/master/src/gui/widgets/StatusFooter.h): `src/gui/widgets/StatusFooter.h`

### Model Access

- [Hugging Face Client](https://github.com/toplib/openatc/blob/master/src/clients/huggingface/HuggingFace.cpp): `src/clients/huggingface/HuggingFace.cpp`
- [HTTP Client](https://github.com/toplib/openatc/blob/master/src/core/net/HttpClient.cpp): `src/core/net/HttpClient.cpp`

### Other components

- **Controller**
- **Pilot Voice**

## Connections

- Microphone VAD → Microphone Input: starts capture (evidence: `src/core/pipeline/microphone/MicrophonePipeline.cpp`)
- Microphone Input → Audio Buffer: buffers samples
- Audio Buffer → Microphone VAD: reads samples (evidence: `src/core/pipeline/microphone/MicrophonePipeline.cpp`)
- Microphone VAD → Speech Recognition: provides speech
- Controller → Microphone Input: speaks into
- Speech Recognition → ATC Orchestrator: transcribed text
- ATC Orchestrator → LLM Interface: requests responses (evidence: `src/core/pipeline/ATCPipeline.cpp`)
- LLM Interface → Llama.cpp Backend: implemented by
- ATC Orchestrator → Speech Synthesis: returns speech text
- Speech Synthesis → Audio Playback: sends audio
- Audio Playback → Pilot Voice: plays response
- GUI Startup → Home Window: creates window (evidence: `src/main.cpp`)
- Home Window → Application Shell: hosts shell (evidence: `src/gui/home/HomeWindow.h`)
- GUI Manager → Application Shell: routes settings
- Application Shell → Activity Page: registers page (evidence: `src/gui/shell/AppShell.cpp`)
- Application Shell → Mode And Hub Pages: registers pages (evidence: `src/gui/shell/AppShell.cpp`)
- Application Shell → Settings Page: registers page (evidence: `src/gui/shell/AppShell.cpp`)
- Application Shell → Navigation Header: connects navigation (evidence: `src/gui/shell/AppShell.cpp`)
- Application Shell → Project Sidebar: connects projects (evidence: `src/gui/shell/AppShell.cpp`)
- Application Shell → Status Footer: creates footer (evidence: `src/gui/shell/AppShell.cpp`)
- Hugging Face Client → HTTP Client: uses HTTP (evidence: `src/clients/huggingface/HuggingFace.cpp`)
