# harshitdevin/voiceguard architecture

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

- Interactive diagram: https://gitdiagram.com/harshitdevin/voiceguard
- Repository: https://github.com/harshitdevin/voiceguard

## Overview

VoiceGuard is a browser-based voice-authenticity detector with an optional Flask/librosa analysis backend. The main workflow takes uploaded audio or a live microphone stream, analyzes it across six signal features, then produces an authenticity score, verdict, and report; live capture also displays a waveform. The graph preserves the six documented analysis stages and the backend alternative. The UI and its wiring are unsampled, so their connections are documented or marked unverified rather than inferred from filenames.

Main entry points: [`server.py`](https://github.com/harshitdevin/voiceguard/blob/main/server.py) (Analysis endpoint), [`analyzer.js`](https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js) (Browser analysis engine), [`index.html`](https://github.com/harshitdevin/voiceguard/blob/main/index.html) (Web interface), [`realtime.js`](https://github.com/harshitdevin/voiceguard/blob/main/realtime.js) (Live capture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Audio inputs"]
  node_ui["Web interface<br/>[index.html]"]
  node_live["Live capture<br/>[realtime.js]"]
end

subgraph group_browser["Browser analysis"]
  node_engine["Browser analysis engine<br/>[analyzer.js]"]
  node_benford["Benford analysis<br/>[benford.js]"]
  node_spectral["Spectral smoothness<br/>[analyzer.js]"]
  node_pitch["Pitch jitter shimmer<br/>[analyzer.js]"]
  node_noise["Noise floor<br/>[analyzer.js]"]
  node_formants["Formant transitions<br/>[analyzer.js]"]
  node_rhythm["Rhythm pauses<br/>[analyzer.js]"]
end

subgraph group_results["Results"]
  node_scoring["Score and verdict<br/>[analyzer.js]"]
  node_report["Analysis report<br/>[analyzer.js]"]
end

subgraph group_backend["Optional Python backend"]
  node_backend_api["Analysis endpoint<br/>[server.py]"]
  node_backend_benford["Benford analysis<br/>[server.py]"]
  node_backend_spectral["Spectral smoothness<br/>[server.py]"]
  node_backend_pitch["Pitch jitter shimmer<br/>[server.py]"]
  node_backend_noise["Noise floor<br/>[server.py]"]
  node_backend_formants["Formant analysis<br/>[server.py]"]
  node_backend_rhythm["Rhythm pauses<br/>[server.py]"]
  node_backend_scoring["Score and verdict<br/>[server.py]"]
  node_backend_report["Analysis report<br/>[server.py]"]
end

node_person(("VoiceGuard user"))
node_mic["Microphone"]

node_person -->|"uses"| node_ui
node_person -->|"speaks into"| node_mic
node_mic -->|"provides audio"| node_live
node_ui -.->|"starts capture"| node_live
node_live -->|"analyzes audio"| node_engine
node_ui -.->|"analyzes upload"| node_engine
node_engine -->|"uses"| node_benford
node_engine -->|"runs"| node_spectral
node_engine -->|"runs"| node_pitch
node_engine -->|"runs"| node_noise
node_engine -->|"runs"| node_formants
node_engine -->|"runs"| node_rhythm
node_engine -->|"combines scores"| node_scoring
node_scoring -->|"produces"| node_report
node_ui -.->|"submits audio"| node_backend_api
node_backend_api -->|"calls"| node_backend_benford
node_backend_api -->|"calls"| node_backend_spectral
node_backend_api -->|"calls"| node_backend_pitch
node_backend_api -->|"calls"| node_backend_noise
node_backend_api -->|"calls"| node_backend_formants
node_backend_api -->|"calls"| node_backend_rhythm
node_backend_api -->|"computes"| node_backend_scoring
node_backend_api -->|"builds"| node_backend_report

click node_ui "https://github.com/harshitdevin/voiceguard/blob/main/index.html"
click node_live "https://github.com/harshitdevin/voiceguard/blob/main/realtime.js"
click node_engine "https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js"
click node_benford "https://github.com/harshitdevin/voiceguard/blob/main/benford.js"
click node_spectral "https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js"
click node_pitch "https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js"
click node_noise "https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js"
click node_formants "https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js"
click node_rhythm "https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js"
click node_scoring "https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js"
click node_report "https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js"
click node_backend_api "https://github.com/harshitdevin/voiceguard/blob/main/server.py"
click node_backend_benford "https://github.com/harshitdevin/voiceguard/blob/main/server.py"
click node_backend_spectral "https://github.com/harshitdevin/voiceguard/blob/main/server.py"
click node_backend_pitch "https://github.com/harshitdevin/voiceguard/blob/main/server.py"
click node_backend_noise "https://github.com/harshitdevin/voiceguard/blob/main/server.py"
click node_backend_formants "https://github.com/harshitdevin/voiceguard/blob/main/server.py"
click node_backend_rhythm "https://github.com/harshitdevin/voiceguard/blob/main/server.py"
click node_backend_scoring "https://github.com/harshitdevin/voiceguard/blob/main/server.py"
click node_backend_report "https://github.com/harshitdevin/voiceguard/blob/main/server.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_ui,node_live,node_person toneBlue
class node_engine,node_benford,node_spectral,node_pitch,node_noise,node_formants,node_rhythm toneAmber
class node_scoring,node_report toneMint
class node_backend_api,node_backend_benford,node_backend_spectral,node_backend_pitch,node_backend_noise,node_backend_formants,node_backend_rhythm,node_backend_scoring,node_backend_report toneRose
class node_mic toneIndigo
```

## Components

### Audio inputs

- [Web interface](https://github.com/harshitdevin/voiceguard/blob/main/index.html): `index.html`
- [Live capture](https://github.com/harshitdevin/voiceguard/blob/main/realtime.js): `realtime.js`

### Browser analysis

- [Browser analysis engine](https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js): `analyzer.js`
- [Benford analysis](https://github.com/harshitdevin/voiceguard/blob/main/benford.js): `benford.js`
- [Spectral smoothness](https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js): `analyzer.js`
- [Pitch jitter shimmer](https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js): `analyzer.js`
- [Noise floor](https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js): `analyzer.js`
- [Formant transitions](https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js): `analyzer.js`
- [Rhythm pauses](https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js): `analyzer.js`

### Results

- [Score and verdict](https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js): `analyzer.js`
- [Analysis report](https://github.com/harshitdevin/voiceguard/blob/main/analyzer.js): `analyzer.js`

### Optional Python backend

- [Analysis endpoint](https://github.com/harshitdevin/voiceguard/blob/main/server.py): `server.py`
- [Benford analysis](https://github.com/harshitdevin/voiceguard/blob/main/server.py): `server.py`
- [Spectral smoothness](https://github.com/harshitdevin/voiceguard/blob/main/server.py): `server.py`
- [Pitch jitter shimmer](https://github.com/harshitdevin/voiceguard/blob/main/server.py): `server.py`
- [Noise floor](https://github.com/harshitdevin/voiceguard/blob/main/server.py): `server.py`
- [Formant analysis](https://github.com/harshitdevin/voiceguard/blob/main/server.py): `server.py`
- [Rhythm pauses](https://github.com/harshitdevin/voiceguard/blob/main/server.py): `server.py`
- [Score and verdict](https://github.com/harshitdevin/voiceguard/blob/main/server.py): `server.py`
- [Analysis report](https://github.com/harshitdevin/voiceguard/blob/main/server.py): `server.py`

### Other components

- **VoiceGuard user**
- **Microphone**

## Connections

- VoiceGuard user → Web interface: uses (evidence: `README.md`)
- VoiceGuard user → Microphone: speaks into (evidence: `README.md`)
- Microphone → Live capture: provides audio (evidence: `realtime.js`)
- Web interface → Live capture: starts capture
- Live capture → Browser analysis engine: analyzes audio (evidence: `realtime.js`)
- Web interface → Browser analysis engine: analyzes upload
- Browser analysis engine → Benford analysis: uses (evidence: `analyzer.js`)
- Browser analysis engine → Spectral smoothness: runs (evidence: `README.md`)
- Browser analysis engine → Pitch jitter shimmer: runs (evidence: `README.md`)
- Browser analysis engine → Noise floor: runs (evidence: `README.md`)
- Browser analysis engine → Formant transitions: runs (evidence: `README.md`)
- Browser analysis engine → Rhythm pauses: runs (evidence: `README.md`)
- Browser analysis engine → Score and verdict: combines scores (evidence: `README.md`)
- Score and verdict → Analysis report: produces (evidence: `README.md`)
- Web interface → Analysis endpoint: submits audio
- Analysis endpoint → Benford analysis: calls (evidence: `server.py`)
- Analysis endpoint → Spectral smoothness: calls (evidence: `server.py`)
- Analysis endpoint → Pitch jitter shimmer: calls (evidence: `server.py`)
- Analysis endpoint → Noise floor: calls (evidence: `server.py`)
- Analysis endpoint → Formant analysis: calls (evidence: `server.py`)
- Analysis endpoint → Rhythm pauses: calls (evidence: `server.py`)
- Analysis endpoint → Score and verdict: computes (evidence: `server.py`)
- Analysis endpoint → Analysis report: builds (evidence: `server.py`)
