# vikassingh2005/voice_ architecture

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

- Interactive diagram: https://gitdiagram.com/vikassingh2005/voice_
- Repository: https://github.com/vikassingh2005/voice_

## Overview

This repository implements a local voice assistant with a FastAPI command interface and a voice-turn pipeline: wake-word detection, microphone capture, transcription, intent handling or LLM response, then optional speech playback. The backend also provides system-control actions, conversational memory, and command logging. The sampled sources show main.py orchestrating these services; app.js and vrm-model.js were read but their contents do not establish connections to the backend, so those links are marked unverified.

Main entry points: [`main.py`](https://github.com/vikassingh2005/voice_/blob/main/main.py) (FastAPI service), [`config.py`](https://github.com/vikassingh2005/voice_/blob/main/config.py) (Assistant configuration), [`app.js`](https://github.com/vikassingh2005/voice_/blob/main/app.js) (Web interface), [`audio_handler.py`](https://github.com/vikassingh2005/voice_/blob/main/audio_handler.py) (Microphone capture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interfaces"]
  node_web_ui["Web interface<br/>[app.js]"]
  node_avatar["VRM model<br/>[vrm-model.js]"]
end

subgraph group_orchestration["Assistant orchestration"]
  node_api["FastAPI service<br/>[main.py]"]
  node_config["Assistant configuration<br/>[config.py]"]
end

subgraph group_voice["Voice processing"]
  node_wake["Wake-word detector<br/>[wake_word.py]"]
  node_audio["Microphone capture<br/>[audio_handler.py]"]
  node_stt["Speech transcription<br/>[stt.py]"]
  node_tts["Speech synthesis<br/>[tts.py]"]
end

subgraph group_intelligence["Intelligence and actions"]
  node_parser["Intent parser<br/>[command_parser.py]"]
  node_llm["LLM response and tools<br/>[llm.py]"]
  node_system["System actions<br/>[system_control.py]"]
end

subgraph group_state["Persistence"]
  node_memory["Semantic memory<br/>[memory.py]"]
  node_chroma[("ChromaDB store")]
  node_logging["Command logging<br/>[database.py]"]
  node_sqlite[("SQLite database<br/>[pravaha_core.db]")]
end

node_user(("User"))
node_microphone(("Microphone"))
node_ollama["Ollama service"]
node_speaker(("Audio output"))

node_user -.->|"uses"| node_web_ui
node_web_ui -.->|"sends commands"| node_api
node_user -->|"speaks"| node_microphone
node_microphone -.->|"streams audio"| node_wake
node_api -->|"dispatches listening"| node_wake
node_api -->|"captures utterance"| node_audio
node_audio -.->|"reads audio"| node_microphone
node_api -->|"transcribes audio"| node_stt
node_api -->|"parses command"| node_parser
node_api -->|"requests response"| node_llm
node_llm -.->|"calls model"| node_ollama
node_api -->|"executes intent"| node_system
node_api -->|"uses context"| node_memory
node_memory -->|"reads and writes"| node_chroma
node_api -->|"speaks response"| node_tts
node_tts -.->|"plays audio"| node_speaker
node_api -->|"logs commands"| node_logging
node_logging -->|"reads and writes"| node_sqlite
node_api -->|"reads settings"| node_config
node_audio -->|"reads settings"| node_config
node_wake -->|"reads settings"| node_config
node_stt -->|"reads settings"| node_config
node_llm -->|"reads settings"| node_config
node_memory -->|"reads settings"| node_config
node_tts -->|"reads settings"| node_config
node_web_ui -.->|"renders model"| node_avatar

click node_web_ui "https://github.com/vikassingh2005/voice_/blob/main/app.js"
click node_avatar "https://github.com/vikassingh2005/voice_/blob/main/vrm-model.js"
click node_api "https://github.com/vikassingh2005/voice_/blob/main/main.py"
click node_config "https://github.com/vikassingh2005/voice_/blob/main/config.py"
click node_wake "https://github.com/vikassingh2005/voice_/blob/main/wake_word.py"
click node_audio "https://github.com/vikassingh2005/voice_/blob/main/audio_handler.py"
click node_stt "https://github.com/vikassingh2005/voice_/blob/main/stt.py"
click node_parser "https://github.com/vikassingh2005/voice_/blob/main/command_parser.py"
click node_llm "https://github.com/vikassingh2005/voice_/blob/main/llm.py"
click node_system "https://github.com/vikassingh2005/voice_/blob/main/system_control.py"
click node_memory "https://github.com/vikassingh2005/voice_/blob/main/memory.py"
click node_tts "https://github.com/vikassingh2005/voice_/blob/main/tts.py"
click node_logging "https://github.com/vikassingh2005/voice_/blob/main/database.py"
click node_sqlite "https://github.com/vikassingh2005/voice_/blob/main/pravaha_core.db"

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_web_ui,node_avatar,node_user toneBlue
class node_api,node_config toneAmber
class node_wake,node_audio,node_stt,node_tts toneMint
class node_parser,node_llm,node_system toneRose
class node_memory,node_chroma,node_logging,node_sqlite,node_microphone,node_ollama,node_speaker toneIndigo
```

## Components

### User interfaces

- [Web interface](https://github.com/vikassingh2005/voice_/blob/main/app.js): `app.js`
- [VRM model](https://github.com/vikassingh2005/voice_/blob/main/vrm-model.js): `vrm-model.js`

### Assistant orchestration

- [FastAPI service](https://github.com/vikassingh2005/voice_/blob/main/main.py): `main.py`
- [Assistant configuration](https://github.com/vikassingh2005/voice_/blob/main/config.py): `config.py`

### Voice processing

- [Wake-word detector](https://github.com/vikassingh2005/voice_/blob/main/wake_word.py): `wake_word.py`
- [Microphone capture](https://github.com/vikassingh2005/voice_/blob/main/audio_handler.py): `audio_handler.py`
- [Speech transcription](https://github.com/vikassingh2005/voice_/blob/main/stt.py): `stt.py`
- [Speech synthesis](https://github.com/vikassingh2005/voice_/blob/main/tts.py): `tts.py`

### Intelligence and actions

- [Intent parser](https://github.com/vikassingh2005/voice_/blob/main/command_parser.py): `command_parser.py`
- [LLM response and tools](https://github.com/vikassingh2005/voice_/blob/main/llm.py): `llm.py`
- [System actions](https://github.com/vikassingh2005/voice_/blob/main/system_control.py): `system_control.py`

### Persistence

- [Semantic memory](https://github.com/vikassingh2005/voice_/blob/main/memory.py): `memory.py`
- **ChromaDB store**
- [Command logging](https://github.com/vikassingh2005/voice_/blob/main/database.py): `database.py`
- [SQLite database](https://github.com/vikassingh2005/voice_/blob/main/pravaha_core.db): `pravaha_core.db`

### Other components

- **User**
- **Microphone**
- **Ollama service**
- **Audio output**

## Connections

- User → Web interface: uses
- Web interface → FastAPI service: sends commands
- User → Microphone: speaks
- Microphone → Wake-word detector: streams audio
- FastAPI service → Wake-word detector: dispatches listening (evidence: `main.py`)
- FastAPI service → Microphone capture: captures utterance (evidence: `main.py`)
- Microphone capture → Microphone: reads audio
- FastAPI service → Speech transcription: transcribes audio (evidence: `main.py`)
- FastAPI service → Intent parser: parses command (evidence: `main.py`)
- FastAPI service → LLM response and tools: requests response (evidence: `main.py`)
- LLM response and tools → Ollama service: calls model
- FastAPI service → System actions: executes intent (evidence: `main.py`)
- FastAPI service → Semantic memory: uses context (evidence: `main.py`)
- Semantic memory → ChromaDB store: reads and writes (evidence: `memory.py`)
- FastAPI service → Speech synthesis: speaks response (evidence: `main.py`)
- Speech synthesis → Audio output: plays audio
- FastAPI service → Command logging: logs commands (evidence: `main.py`)
- Command logging → SQLite database: reads and writes (evidence: `database.py`)
- FastAPI service → Assistant configuration: reads settings (evidence: `main.py`)
- Microphone capture → Assistant configuration: reads settings (evidence: `audio_handler.py`)
- Wake-word detector → Assistant configuration: reads settings (evidence: `wake_word.py`)
- Speech transcription → Assistant configuration: reads settings (evidence: `stt.py`)
- LLM response and tools → Assistant configuration: reads settings (evidence: `llm.py`)
- Semantic memory → Assistant configuration: reads settings (evidence: `memory.py`)
- Speech synthesis → Assistant configuration: reads settings (evidence: `tts.py`)
- Web interface → VRM model: renders model
