# i-am-dhruv/edge-tts-kotlin architecture

> Architecture diagram of the GitHub repository i-am-dhruv/edge-tts-kotlin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/i-am-dhruv/edge-tts-kotlin
- Repository: https://github.com/i-am-dhruv/edge-tts-kotlin

## Overview

EdgeTTS Kotlin is an Android library for discovering Microsoft neural voices and synthesizing speech through Edge’s online Read Aloud service. The primary workflow is an app calling the EdgeTts API with text and prosody options, streaming audio and timing events from the service, then collecting results, exporting subtitles, or playing audio. Voice discovery is a separate capability; the protocol and configuration modules support the service interactions. Some implementation details were not sampled, so uncertain internal links are omitted.

Main entry points: [`edgetts/src/main/java/com/edgetts/EdgeTts.kt`](https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/EdgeTts.kt) (EdgeTts API), [`edgetts/src/main/java/com/edgetts/Communicate.kt`](https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/Communicate.kt) (Synthesis session), [`edgetts/src/main/java/com/edgetts/VoicesManager.kt`](https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/VoicesManager.kt) (Voice catalog), [`edgetts/src/main/java/com/edgetts/EdgeTtsModels.kt`](https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/EdgeTtsModels.kt) (Options and results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public API"]
  node_api["EdgeTts API<br/>[EdgeTts.kt]"]
  node_options["Options and results<br/>[EdgeTtsModels.kt]"]
end

subgraph group_synthesis["Speech Synthesis"]
  node_config["Service configuration<br/>[EdgeTtsConfig.kt]"]
  node_communicate["Synthesis session<br/>[Communicate.kt]"]
  node_protocol["Wire protocol<br/>[EdgeTtsProtocol.kt]"]
end

subgraph group_voices["Voice Discovery"]
  node_voice_manager["Voice catalog<br/>[VoicesManager.kt]"]
end

subgraph group_playback["Playback and Subtitles"]
  node_player["Android player<br/>[EdgeTtsPlayer.kt]"]
  node_submaker["Subtitle builder<br/>[SubMaker.kt]"]
end

node_app(("Android app"))
node_edge_service{{"Edge Read Aloud"}}

node_app -->|"calls"| node_api
node_api -->|"creates sessions"| node_communicate
node_api -->|"delegates lookup"| node_voice_manager
node_api -->|"creates player"| node_player
node_communicate -->|"uses settings"| node_config
node_communicate -->|"parses frames"| node_protocol
node_communicate -->|"streams synthesis"| node_edge_service
node_protocol -->|"reads options"| node_options
node_voice_manager -->|"uses token settings"| node_config
node_voice_manager -->|"fetches catalog"| node_edge_service
node_player -->|"streams speech"| node_api
node_app -->|"feeds events"| node_submaker
node_options -->|"formats timings"| node_submaker

click node_api "https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/EdgeTts.kt"
click node_options "https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/EdgeTtsModels.kt"
click node_config "https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/EdgeTtsConfig.kt"
click node_communicate "https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/Communicate.kt"
click node_protocol "https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/internal/EdgeTtsProtocol.kt"
click node_voice_manager "https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/VoicesManager.kt"
click node_player "https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/EdgeTtsPlayer.kt"
click node_submaker "https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/SubMaker.kt"

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_api,node_options toneBlue
class node_config,node_communicate,node_protocol toneAmber
class node_voice_manager toneMint
class node_player,node_submaker toneRose
class node_app,node_edge_service toneIndigo
```

## Components

### Public API

- [EdgeTts API](https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/EdgeTts.kt): `edgetts/src/main/java/com/edgetts/EdgeTts.kt`
- [Options and results](https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/EdgeTtsModels.kt): `edgetts/src/main/java/com/edgetts/EdgeTtsModels.kt`

### Speech Synthesis

- [Service configuration](https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/EdgeTtsConfig.kt): `edgetts/src/main/java/com/edgetts/EdgeTtsConfig.kt`
- [Synthesis session](https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/Communicate.kt): `edgetts/src/main/java/com/edgetts/Communicate.kt`
- [Wire protocol](https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/internal/EdgeTtsProtocol.kt): `edgetts/src/main/java/com/edgetts/internal/EdgeTtsProtocol.kt`

### Voice Discovery

- [Voice catalog](https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/VoicesManager.kt): `edgetts/src/main/java/com/edgetts/VoicesManager.kt`

### Playback and Subtitles

- [Android player](https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/EdgeTtsPlayer.kt): `edgetts/src/main/java/com/edgetts/EdgeTtsPlayer.kt`
- [Subtitle builder](https://github.com/i-am-dhruv/edge-tts-kotlin/blob/main/edgetts/src/main/java/com/edgetts/SubMaker.kt): `edgetts/src/main/java/com/edgetts/SubMaker.kt`

### Other components

- **Android app**
- **Edge Read Aloud**

## Connections

- Android app → EdgeTts API: calls (evidence: `README.md`)
- EdgeTts API → Synthesis session: creates sessions (evidence: `edgetts/src/main/java/com/edgetts/EdgeTts.kt`)
- EdgeTts API → Voice catalog: delegates lookup (evidence: `edgetts/src/main/java/com/edgetts/EdgeTts.kt`)
- EdgeTts API → Android player: creates player (evidence: `edgetts/src/main/java/com/edgetts/EdgeTts.kt`)
- Synthesis session → Service configuration: uses settings (evidence: `edgetts/src/main/java/com/edgetts/Communicate.kt`)
- Synthesis session → Wire protocol: parses frames (evidence: `edgetts/src/main/java/com/edgetts/Communicate.kt`)
- Synthesis session → Edge Read Aloud: streams synthesis (evidence: `README.md`)
- Wire protocol → Options and results: reads options (evidence: `edgetts/src/main/java/com/edgetts/internal/EdgeTtsProtocol.kt`)
- Voice catalog → Service configuration: uses token settings (evidence: `edgetts/src/main/java/com/edgetts/VoicesManager.kt`)
- Voice catalog → Edge Read Aloud: fetches catalog (evidence: `edgetts/src/main/java/com/edgetts/VoicesManager.kt`)
- Android player → EdgeTts API: streams speech (evidence: `edgetts/src/main/java/com/edgetts/EdgeTtsPlayer.kt`)
- Android app → Subtitle builder: feeds events (evidence: `README.md`)
- Options and results → Subtitle builder: formats timings (evidence: `edgetts/src/main/java/com/edgetts/EdgeTtsModels.kt`)
