# tripathi0704/audioartifact architecture

> Architecture diagram of the GitHub repository tripathi0704/audioartifact, 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/tripathi0704/audioartifact
- Repository: https://github.com/tripathi0704/audioartifact

## Overview

AudioArtifact is a forensic audio application: a user submits recordings through a Streamlit dashboard, the FastAPI backend analyzes them into time-localized synthetic-speech results, and the dashboard presents evidence and investigation tools. The documented product also includes live screening, speaker matching, batch scans, history, AI assistance, and report generation. The graph reflects sampled backend calls and documented capabilities; several dashboard internals and some capability-specific routes were not shown, so those links are documented or left unverified rather than inferred as source-level calls.

Main entry points: [`backend/main.py`](https://github.com/tripathi0704/audioartifact/blob/main/backend/main.py) (Forensic API), [`frontend/app.py`](https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py) (Forensic dashboard), [`backend/ai_copilot.py`](https://github.com/tripathi0704/audioartifact/blob/main/backend/ai_copilot.py) (Forensic AI), [`feature_extraction.py`](https://github.com/tripathi0704/audioartifact/blob/main/feature_extraction.py) (Training features)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Forensic experience"]
  node_dashboard["Forensic dashboard<br/>[app.py]"]
  node_single["Single scan<br/>[app.py]"]
  node_live["Live mic test<br/>[app.py]"]
  node_batch["Batch scanner<br/>[app.py]"]
  node_speaker_ui["Speaker matcher<br/>[app.py]"]
  node_timeline["Timeline results<br/>[app.py]"]
end

subgraph group_analysis["Audio analysis"]
  node_api["Forensic API<br/>[main.py]"]
  node_vad["Speech detection<br/>[vad_utils.py]"]
  node_wavlm["WavLM embeddings<br/>[main.py]"]
  node_classifier["Deepfake scoring<br/>[main.py]"]
  node_speaker_compare["Voice comparison<br/>[main.py]"]
  node_feature_data["Training features"]
  node_model_training["Model training<br/>[train_model.py]"]
end

subgraph group_evidence["Evidence and records"]
  node_integrity["Acoustic evidence<br/>[forensic_utils.py]"]
  node_history_api["History service<br/>[main.py]"]
  node_history_db[("Scan history<br/>[db.py]")]
  node_audit["Audit certificate<br/>[forensic_utils.py]"]
  node_petition["FIR petition PDF<br/>[forensic_utils.py]"]
end

subgraph group_intelligence["AI intelligence"]
  node_copilot_ui["Copilot interface<br/>[app.py]"]
  node_ai["Forensic AI<br/>[ai_copilot.py]"]
end

node_investigator(("Investigator"))
node_gemini{{"Google Gemini"}}

node_investigator -->|"uses"| node_dashboard
node_dashboard -->|"starts scan"| node_single
node_dashboard -->|"records audio"| node_live
node_dashboard -->|"scans files"| node_batch
node_dashboard -->|"compares voices"| node_speaker_ui
node_single -.->|"submits audio"| node_api
node_api -->|"filters speech"| node_vad
node_api -->|"extracts embeddings"| node_wavlm
node_api -->|"scores windows"| node_classifier
node_api -->|"builds evidence"| node_integrity
node_classifier -.->|"returns probabilities"| node_timeline
node_api -->|"compares recordings"| node_speaker_compare
node_speaker_ui -.->|"requests match"| node_api
node_api -->|"serves history"| node_history_api
node_history_api -->|"reads records"| node_history_db
node_history_api -->|"saves scans"| node_history_db
node_api -->|"generates certificate"| node_audit
node_investigator -->|"asks questions"| node_copilot_ui
node_copilot_ui -.->|"sends context"| node_ai
node_ai -.->|"requests analysis"| node_gemini
node_api -->|"routes AI requests"| node_ai
node_dashboard -->|"downloads petition"| node_petition
node_feature_data -->|"filters speech"| node_vad
node_feature_data -.->|"extracts embeddings"| node_wavlm
node_model_training -.->|"produces detector"| node_classifier

click node_dashboard "https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py"
click node_single "https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py"
click node_live "https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py"
click node_batch "https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py"
click node_speaker_ui "https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py"
click node_timeline "https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py"
click node_api "https://github.com/tripathi0704/audioartifact/blob/main/backend/main.py"
click node_vad "https://github.com/tripathi0704/audioartifact/blob/main/backend/vad_utils.py"
click node_wavlm "https://github.com/tripathi0704/audioartifact/blob/main/backend/main.py"
click node_classifier "https://github.com/tripathi0704/audioartifact/blob/main/backend/main.py"
click node_integrity "https://github.com/tripathi0704/audioartifact/blob/main/backend/forensic_utils.py"
click node_speaker_compare "https://github.com/tripathi0704/audioartifact/blob/main/backend/main.py"
click node_history_api "https://github.com/tripathi0704/audioartifact/blob/main/backend/main.py"
click node_history_db "https://github.com/tripathi0704/audioartifact/blob/main/backend/db.py"
click node_audit "https://github.com/tripathi0704/audioartifact/blob/main/backend/forensic_utils.py"
click node_petition "https://github.com/tripathi0704/audioartifact/blob/main/backend/forensic_utils.py"
click node_copilot_ui "https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py"
click node_ai "https://github.com/tripathi0704/audioartifact/blob/main/backend/ai_copilot.py"
click node_feature_data "https://github.com/tripathi0704/audioartifact/blob/main/feature_extraction.py"
click node_model_training "https://github.com/tripathi0704/audioartifact/blob/main/train_model.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_dashboard,node_single,node_live,node_batch,node_speaker_ui,node_timeline toneBlue
class node_api,node_vad,node_wavlm,node_classifier,node_speaker_compare,node_feature_data,node_model_training toneAmber
class node_integrity,node_history_api,node_history_db,node_audit,node_petition toneMint
class node_copilot_ui,node_ai toneRose
class node_investigator,node_gemini toneIndigo
```

## Components

### Forensic experience

- [Forensic dashboard](https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py): `frontend/app.py`
- [Single scan](https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py): `frontend/app.py`
- [Live mic test](https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py): `frontend/app.py`
- [Batch scanner](https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py): `frontend/app.py`
- [Speaker matcher](https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py): `frontend/app.py`
- [Timeline results](https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py): `frontend/app.py`

### Audio analysis

- [Forensic API](https://github.com/tripathi0704/audioartifact/blob/main/backend/main.py): `backend/main.py`
- [Speech detection](https://github.com/tripathi0704/audioartifact/blob/main/backend/vad_utils.py): `backend/vad_utils.py`
- [WavLM embeddings](https://github.com/tripathi0704/audioartifact/blob/main/backend/main.py): `backend/main.py`
- [Deepfake scoring](https://github.com/tripathi0704/audioartifact/blob/main/backend/main.py): `backend/main.py`
- [Voice comparison](https://github.com/tripathi0704/audioartifact/blob/main/backend/main.py): `backend/main.py`
- [Training features](https://github.com/tripathi0704/audioartifact/blob/main/feature_extraction.py): `feature_extraction.py`
- [Model training](https://github.com/tripathi0704/audioartifact/blob/main/train_model.py): `train_model.py`

### Evidence and records

- [Acoustic evidence](https://github.com/tripathi0704/audioartifact/blob/main/backend/forensic_utils.py): `backend/forensic_utils.py`
- [History service](https://github.com/tripathi0704/audioartifact/blob/main/backend/main.py): `backend/main.py`
- [Scan history](https://github.com/tripathi0704/audioartifact/blob/main/backend/db.py): `backend/db.py`
- [Audit certificate](https://github.com/tripathi0704/audioartifact/blob/main/backend/forensic_utils.py): `backend/forensic_utils.py`
- [FIR petition PDF](https://github.com/tripathi0704/audioartifact/blob/main/backend/forensic_utils.py): `backend/forensic_utils.py`

### AI intelligence

- [Copilot interface](https://github.com/tripathi0704/audioartifact/blob/main/frontend/app.py): `frontend/app.py`
- [Forensic AI](https://github.com/tripathi0704/audioartifact/blob/main/backend/ai_copilot.py): `backend/ai_copilot.py`

### Other components

- **Investigator**
- **Google Gemini**

## Connections

- Investigator → Forensic dashboard: uses (evidence: `README.md`)
- Forensic dashboard → Single scan: starts scan (evidence: `README.md`)
- Forensic dashboard → Live mic test: records audio (evidence: `README.md`)
- Forensic dashboard → Batch scanner: scans files (evidence: `README.md`)
- Forensic dashboard → Speaker matcher: compares voices (evidence: `README.md`)
- Single scan → Forensic API: submits audio (evidence: `frontend/app.py`)
- Forensic API → Speech detection: filters speech (evidence: `backend/main.py`)
- Forensic API → WavLM embeddings: extracts embeddings (evidence: `backend/main.py`)
- Forensic API → Deepfake scoring: scores windows (evidence: `backend/main.py`)
- Forensic API → Acoustic evidence: builds evidence (evidence: `backend/main.py`)
- Deepfake scoring → Timeline results: returns probabilities (evidence: `frontend/app.py`)
- Forensic API → Voice comparison: compares recordings (evidence: `backend/main.py`)
- Speaker matcher → Forensic API: requests match (evidence: `frontend/app.py`)
- Forensic API → History service: serves history (evidence: `backend/main.py`)
- History service → Scan history: reads records (evidence: `backend/main.py`)
- History service → Scan history: saves scans (evidence: `backend/main.py`)
- Forensic API → Audit certificate: generates certificate (evidence: `backend/main.py`)
- Investigator → Copilot interface: asks questions (evidence: `README.md`)
- Copilot interface → Forensic AI: sends context (evidence: `frontend/app.py`)
- Forensic AI → Google Gemini: requests analysis (evidence: `backend/ai_copilot.py`)
- Forensic API → Forensic AI: routes AI requests (evidence: `backend/main.py`)
- Forensic dashboard → FIR petition PDF: downloads petition (evidence: `frontend/app.py`)
- Training features → Speech detection: filters speech (evidence: `feature_extraction.py`)
- Training features → WavLM embeddings: extracts embeddings
- Model training → Deepfake scoring: produces detector
