# serveurpersocom/omnivoice.cpp architecture

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

- Interactive diagram: https://gitdiagram.com/serveurpersocom/omnivoice.cpp
- Repository: https://github.com/serveurpersocom/omnivoice.cpp

## Overview

OmniVoice.cpp is a local GGML-based text-to-speech engine and C ABI, with command-line, codec, and OpenAI-compatible server interfaces. The main synthesis flow accepts text and optional voice-reference data, builds prompts, generates RVQ audio codes, decodes them to 24 kHz audio, then post-processes and returns or writes the waveform. Voice design, cloning, long-form chunking, codec conversion, and server voice registration are additional product capabilities. Relationships below use README statements and source-index references; several implementation details were not sampled, so uncertain links are omitted.

Main entry points: [`src/pipeline-tts.cpp`](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/pipeline-tts.cpp) (TTS orchestration), [`src/pipeline-codec.cpp`](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/pipeline-codec.cpp) (Codec orchestration), [`src/omnivoice.cpp`](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/omnivoice.cpp) (Public C ABI), [`tools/omnivoice-codec.cpp`](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/tools/omnivoice-codec.cpp) (Codec command line)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_tts_cli["TTS command line<br/>[omnivoice-tts.cpp]"]
  node_codec_cli["Codec command line"]
  node_server["HTTP server<br/>[tts-server.h]"]
  node_api["Public C ABI<br/>[omnivoice.cpp]"]
end

subgraph group_synthesis["Speech synthesis"]
  node_prompt["Prompt builder<br/>[prompt-tts.h]"]
  node_voice_design["Voice design<br/>[voice-design.h]"]
  node_language["Language mapping<br/>[lang-map.h]"]
  node_text_chunks["Text chunking<br/>[text-chunker.h]"]
  node_tts_pipeline["TTS orchestration<br/>[pipeline-tts.cpp]"]
  node_maskgit["MaskGIT generation<br/>[maskgit-tts.h]"]
  node_lm["Qwen3 audio language model<br/>[omnivoice-llm.h]"]
end

subgraph group_audio["Codec and audio"]
  node_codec_pipeline["Codec orchestration<br/>[pipeline-codec.cpp]"]
  node_rvq["RVQ codec<br/>[rvq-codec.h]"]
  node_rvq_file["RVQ file format<br/>[rvq-file.h]"]
  node_dac["DAC audio decoder<br/>[dac-decoder.h]"]
  node_audio_post["Waveform post-processing<br/>[audio-postproc.h]"]
  node_audio_io["Audio I/O<br/>[audio-io.h]"]
end

subgraph group_runtime["Model runtime"]
  node_weights["GGUF weight loader<br/>[gguf-weights.h]"]
  node_backend["GGML backends<br/>[backend.h]"]
  node_weight_ctx["Weight context<br/>[weight-ctx.h]"]
  node_bpe["BPE tokenizer<br/>[bpe.h]"]
  node_duration["Duration estimator"]
end

node_caller(("User or client"))

node_caller -->|"supplies text"| node_tts_cli
node_tts_cli -->|"calls library"| node_api
node_caller -->|"requests conversion"| node_codec_cli
node_codec_cli -->|"encodes or decodes"| node_codec_pipeline
node_caller -->|"sends requests"| node_server
node_server -->|"synthesizes speech"| node_api
node_api -->|"runs synthesis"| node_tts_pipeline
node_api -->|"uses codec"| node_codec_pipeline
node_api -->|"applies voice design"| node_voice_design
node_api -->|"post-processes audio"| node_audio_post
node_tts_pipeline -->|"builds prompts"| node_prompt
node_tts_pipeline -->|"runs generation"| node_maskgit
node_tts_pipeline -->|"decodes codes"| node_codec_pipeline
node_tts_pipeline -->|"chunks text"| node_text_chunks
node_tts_pipeline -->|"post-processes audio"| node_audio_post
node_prompt -->|"tokenizes text"| node_bpe
node_prompt -->|"maps languages"| node_language
node_maskgit -->|"uses model"| node_lm
node_codec_pipeline -->|"encodes and decodes"| node_rvq
node_codec_pipeline -->|"decodes waveforms"| node_dac
node_codec_pipeline -->|"loads weights"| node_weights
node_codec_cli -->|"reads or writes codes"| node_rvq_file
node_server -->|"uses audio I/O"| node_audio_io
node_tts_pipeline -->|"schedules inference"| node_backend
node_tts_pipeline -->|"holds weights"| node_weight_ctx
node_codec_pipeline -->|"runs inference"| node_backend
node_weights -->|"loads tensors into"| node_weight_ctx
node_tts_pipeline -->|"estimates duration"| node_duration

click node_tts_cli "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/tools/omnivoice-tts.cpp"
click node_codec_cli "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/tools/omnivoice-codec.cpp"
click node_server "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/tts-server.h"
click node_api "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/omnivoice.cpp"
click node_prompt "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/prompt-tts.h"
click node_voice_design "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/voice-design.h"
click node_language "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/lang-map.h"
click node_text_chunks "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/text-chunker.h"
click node_tts_pipeline "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/pipeline-tts.cpp"
click node_maskgit "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/maskgit-tts.h"
click node_lm "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/omnivoice-llm.h"
click node_codec_pipeline "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/pipeline-codec.cpp"
click node_rvq "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/rvq-codec.h"
click node_rvq_file "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/rvq-file.h"
click node_dac "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/dac-decoder.h"
click node_audio_post "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/audio-postproc.h"
click node_audio_io "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/audio-io.h"
click node_weights "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/gguf-weights.h"
click node_backend "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/backend.h"
click node_weight_ctx "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/weight-ctx.h"
click node_bpe "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/bpe.h"
click node_duration "https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/duration-estimator.h"

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_tts_cli,node_codec_cli,node_server,node_api,node_caller toneBlue
class node_prompt,node_voice_design,node_language,node_text_chunks,node_tts_pipeline,node_maskgit,node_lm toneAmber
class node_codec_pipeline,node_rvq,node_rvq_file,node_dac,node_audio_post,node_audio_io toneMint
class node_weights,node_backend,node_weight_ctx,node_bpe,node_duration toneRose
```

## Components

### User interfaces

- [TTS command line](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/tools/omnivoice-tts.cpp): `tools/omnivoice-tts.cpp`
- [Codec command line](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/tools/omnivoice-codec.cpp): `tools/omnivoice-codec.cpp`
- [HTTP server](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/tts-server.h): `src/tts-server.h`
- [Public C ABI](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/omnivoice.cpp): `src/omnivoice.cpp`

### Speech synthesis

- [Prompt builder](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/prompt-tts.h): `src/prompt-tts.h`
- [Voice design](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/voice-design.h): `src/voice-design.h`
- [Language mapping](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/lang-map.h): `src/lang-map.h`
- [Text chunking](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/text-chunker.h): `src/text-chunker.h`
- [TTS orchestration](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/pipeline-tts.cpp): `src/pipeline-tts.cpp`
- [MaskGIT generation](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/maskgit-tts.h): `src/maskgit-tts.h`
- [Qwen3 audio language model](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/omnivoice-llm.h): `src/omnivoice-llm.h`

### Codec and audio

- [Codec orchestration](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/pipeline-codec.cpp): `src/pipeline-codec.cpp`
- [RVQ codec](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/rvq-codec.h): `src/rvq-codec.h`
- [RVQ file format](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/rvq-file.h): `src/rvq-file.h`
- [DAC audio decoder](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/dac-decoder.h): `src/dac-decoder.h`
- [Waveform post-processing](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/audio-postproc.h): `src/audio-postproc.h`
- [Audio I/O](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/audio-io.h): `src/audio-io.h`

### Model runtime

- [GGUF weight loader](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/gguf-weights.h): `src/gguf-weights.h`
- [GGML backends](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/backend.h): `src/backend.h`
- [Weight context](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/weight-ctx.h): `src/weight-ctx.h`
- [BPE tokenizer](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/bpe.h): `src/bpe.h`
- [Duration estimator](https://github.com/serveurpersocom/omnivoice.cpp/blob/master/src/duration-estimator.h): `src/duration-estimator.h`

### Other components

- **User or client**

## Connections

- User or client → TTS command line: supplies text (evidence: `README.md`)
- TTS command line → Public C ABI: calls library (evidence: `README.md`)
- User or client → Codec command line: requests conversion (evidence: `README.md`)
- Codec command line → Codec orchestration: encodes or decodes (evidence: `tools/omnivoice-codec.cpp`)
- User or client → HTTP server: sends requests (evidence: `README.md`)
- HTTP server → Public C ABI: synthesizes speech (evidence: `README.md`)
- Public C ABI → TTS orchestration: runs synthesis (evidence: `src/omnivoice.cpp`)
- Public C ABI → Codec orchestration: uses codec (evidence: `src/omnivoice.cpp`)
- Public C ABI → Voice design: applies voice design (evidence: `src/omnivoice.cpp`)
- Public C ABI → Waveform post-processing: post-processes audio (evidence: `src/omnivoice.cpp`)
- TTS orchestration → Prompt builder: builds prompts (evidence: `src/pipeline-tts.cpp`)
- TTS orchestration → MaskGIT generation: runs generation (evidence: `src/pipeline-tts.cpp`)
- TTS orchestration → Codec orchestration: decodes codes (evidence: `src/pipeline-tts.cpp`)
- TTS orchestration → Text chunking: chunks text (evidence: `src/pipeline-tts.cpp`)
- TTS orchestration → Waveform post-processing: post-processes audio (evidence: `src/pipeline-tts.cpp`)
- Prompt builder → BPE tokenizer: tokenizes text (evidence: `src/prompt-tts.h`)
- Prompt builder → Language mapping: maps languages (evidence: `src/prompt-tts.h`)
- MaskGIT generation → Qwen3 audio language model: uses model (evidence: `src/maskgit-tts.h`)
- Codec orchestration → RVQ codec: encodes and decodes
- Codec orchestration → DAC audio decoder: decodes waveforms
- Codec orchestration → GGUF weight loader: loads weights
- Codec command line → RVQ file format: reads or writes codes (evidence: `tools/omnivoice-codec.cpp`)
- HTTP server → Audio I/O: uses audio I/O (evidence: `src/tts-server.h`)
- TTS orchestration → GGML backends: schedules inference
- TTS orchestration → Weight context: holds weights
- Codec orchestration → GGML backends: runs inference
- GGUF weight loader → Weight context: loads tensors into (evidence: `src/gguf-weights.h`)
- TTS orchestration → Duration estimator: estimates duration (evidence: `src/pipeline-tts.cpp`)
