# shlok1286/audiodeepfake architecture

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

- Interactive diagram: https://gitdiagram.com/shlok1286/audiodeepfake
- Repository: https://github.com/shlok1286/audiodeepfake

## Overview

VerifyVoice is a web application for detecting synthetic speech and explaining predictions. A user uploads a recording in the Next.js interface; the client submits it to FastAPI, which decodes and chunks the audio, prepares Mel-spectrogram features, runs the classifier, and generates a Grad-CAM explanation. The interface presents the verdict and playback/visualization, and can save analyses in browser history. The README documents the main backend stages and capabilities; some frontend component links are supported by the SOURCE INDEX rather than complete call-site excerpts.

Main entry points: [`app/page.tsx`](https://github.com/shlok1286/audiodeepfake/blob/main/app/page.tsx) (Upload interface), [`lib/analyzeAudio.ts`](https://github.com/shlok1286/audiodeepfake/blob/main/lib/analyzeAudio.ts) (API client), [`components/ResultCard.tsx`](https://github.com/shlok1286/audiodeepfake/blob/main/components/ResultCard.tsx) (Verdict card), [`components/AudioPlayer.tsx`](https://github.com/shlok1286/audiodeepfake/blob/main/components/AudioPlayer.tsx) (Audio player)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["Upload interface<br/>[page.tsx]"]
  node_client["API client<br/>[analyzeAudio.ts]"]
  node_history[("Analysis history<br/>[historyDb.ts]")]
  node_nav["Navigation<br/>[navbar.tsx]"]
  node_loader["Analysis loader<br/>[ai-loader.tsx]"]
end

subgraph group_presentation["Analysis presentation"]
  node_results["Verdict card<br/>[ResultCard.tsx]"]
  node_player["Audio player<br/>[AudioPlayer.tsx]"]
  node_visualizer["Audio visualizer"]
  node_regions["Suspicious regions"]
  node_explanation["Grad-CAM explanation"]
  node_historyview["History browser<br/>[HistoryView.tsx]"]
end

subgraph group_service["Inference service"]
  node_api["Prediction API<br/>[main.py]"]
end

subgraph group_ml["Audio intelligence"]
  node_decode["Audio preparation<br/>[pipeline.py]"]
  node_classifier["CNN classifier<br/>[model.py]"]
  node_cam["Grad-CAM generator<br/>[gradcam.py]"]
  node_store["Model weights"]
end

node_user(("Audio user"))

node_user -->|"uploads audio"| node_app
node_app -->|"requests analysis"| node_client
node_client -->|"posts multipart"| node_api
node_api -->|"runs pipeline"| node_decode
node_decode -->|"provides features"| node_classifier
node_classifier -->|"supplies activations"| node_cam
node_store -.->|"provides weights"| node_classifier
node_api -->|"returns prediction"| node_client
node_client -.->|"normalizes result"| node_results
node_results -->|"renders playback"| node_player
node_player -->|"renders waveform"| node_visualizer
node_player -->|"renders regions"| node_regions
node_results -->|"renders explanation"| node_explanation
node_app -->|"saves analyses"| node_history
node_app -->|"loads history"| node_history
node_historyview -->|"reads history"| node_history
node_app -.->|"shows history"| node_historyview
node_app -->|"renders navigation"| node_nav
node_app -->|"shows progress"| node_loader

click node_app "https://github.com/shlok1286/audiodeepfake/blob/main/app/page.tsx"
click node_client "https://github.com/shlok1286/audiodeepfake/blob/main/lib/analyzeAudio.ts"
click node_history "https://github.com/shlok1286/audiodeepfake/blob/main/lib/historyDb.ts"
click node_nav "https://github.com/shlok1286/audiodeepfake/blob/main/components/ui/navbar.tsx"
click node_loader "https://github.com/shlok1286/audiodeepfake/blob/main/components/ui/ai-loader.tsx"
click node_results "https://github.com/shlok1286/audiodeepfake/blob/main/components/ResultCard.tsx"
click node_player "https://github.com/shlok1286/audiodeepfake/blob/main/components/AudioPlayer.tsx"
click node_visualizer "https://github.com/shlok1286/audiodeepfake/blob/main/components/AudioVisualizer.tsx"
click node_regions "https://github.com/shlok1286/audiodeepfake/blob/main/components/SuspiciousRegionsPanel.tsx"
click node_explanation "https://github.com/shlok1286/audiodeepfake/blob/main/components/PredictionExplanation.tsx"
click node_historyview "https://github.com/shlok1286/audiodeepfake/blob/main/components/HistoryView.tsx"
click node_api "https://github.com/shlok1286/audiodeepfake/blob/main/backend/main.py"
click node_decode "https://github.com/shlok1286/audiodeepfake/blob/main/backend/pipeline.py"
click node_classifier "https://github.com/shlok1286/audiodeepfake/blob/main/backend/model.py"
click node_cam "https://github.com/shlok1286/audiodeepfake/blob/main/backend/gradcam.py"
click node_store "https://github.com/shlok1286/audiodeepfake/blob/main/Model/CNN_4Layer_64_128_256_512_BN_Dropout_best.pth"

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_app,node_client,node_history,node_nav,node_loader,node_user toneBlue
class node_results,node_player,node_visualizer,node_regions,node_explanation,node_historyview toneAmber
class node_api toneMint
class node_decode,node_classifier,node_cam,node_store toneRose
```

## Components

### Web experience

- [Upload interface](https://github.com/shlok1286/audiodeepfake/blob/main/app/page.tsx): `app/page.tsx`
- [API client](https://github.com/shlok1286/audiodeepfake/blob/main/lib/analyzeAudio.ts): `lib/analyzeAudio.ts`
- [Analysis history](https://github.com/shlok1286/audiodeepfake/blob/main/lib/historyDb.ts): `lib/historyDb.ts`
- [Navigation](https://github.com/shlok1286/audiodeepfake/blob/main/components/ui/navbar.tsx): `components/ui/navbar.tsx`
- [Analysis loader](https://github.com/shlok1286/audiodeepfake/blob/main/components/ui/ai-loader.tsx): `components/ui/ai-loader.tsx`

### Analysis presentation

- [Verdict card](https://github.com/shlok1286/audiodeepfake/blob/main/components/ResultCard.tsx): `components/ResultCard.tsx`
- [Audio player](https://github.com/shlok1286/audiodeepfake/blob/main/components/AudioPlayer.tsx): `components/AudioPlayer.tsx`
- [Audio visualizer](https://github.com/shlok1286/audiodeepfake/blob/main/components/AudioVisualizer.tsx): `components/AudioVisualizer.tsx`
- [Suspicious regions](https://github.com/shlok1286/audiodeepfake/blob/main/components/SuspiciousRegionsPanel.tsx): `components/SuspiciousRegionsPanel.tsx`
- [Grad-CAM explanation](https://github.com/shlok1286/audiodeepfake/blob/main/components/PredictionExplanation.tsx): `components/PredictionExplanation.tsx`
- [History browser](https://github.com/shlok1286/audiodeepfake/blob/main/components/HistoryView.tsx): `components/HistoryView.tsx`

### Inference service

- [Prediction API](https://github.com/shlok1286/audiodeepfake/blob/main/backend/main.py): `backend/main.py`

### Audio intelligence

- [Audio preparation](https://github.com/shlok1286/audiodeepfake/blob/main/backend/pipeline.py): `backend/pipeline.py`
- [CNN classifier](https://github.com/shlok1286/audiodeepfake/blob/main/backend/model.py): `backend/model.py`
- [Grad-CAM generator](https://github.com/shlok1286/audiodeepfake/blob/main/backend/gradcam.py): `backend/gradcam.py`
- [Model weights](https://github.com/shlok1286/audiodeepfake/blob/main/Model/CNN_4Layer_64_128_256_512_BN_Dropout_best.pth): `Model/CNN_4Layer_64_128_256_512_BN_Dropout_best.pth`

### Other components

- **Audio user**

## Connections

- Audio user → Upload interface: uploads audio (evidence: `README.md`)
- Upload interface → API client: requests analysis (evidence: `app/page.tsx`)
- API client → Prediction API: posts multipart (evidence: `lib/analyzeAudio.ts`)
- Prediction API → Audio preparation: runs pipeline (evidence: `README.md`)
- Audio preparation → CNN classifier: provides features (evidence: `README.md`)
- CNN classifier → Grad-CAM generator: supplies activations (evidence: `README.md`)
- Model weights → CNN classifier: provides weights
- Prediction API → API client: returns prediction (evidence: `README.md`)
- API client → Verdict card: normalizes result (evidence: `components/ResultCard.tsx`)
- Verdict card → Audio player: renders playback (evidence: `components/ResultCard.tsx`)
- Audio player → Audio visualizer: renders waveform (evidence: `components/AudioPlayer.tsx`)
- Audio player → Suspicious regions: renders regions (evidence: `components/AudioPlayer.tsx`)
- Verdict card → Grad-CAM explanation: renders explanation (evidence: `components/ResultCard.tsx`)
- Upload interface → Analysis history: saves analyses (evidence: `app/page.tsx`)
- Upload interface → Analysis history: loads history (evidence: `app/page.tsx`)
- History browser → Analysis history: reads history (evidence: `components/HistoryView.tsx`)
- Upload interface → History browser: shows history (evidence: `app/page.tsx`)
- Upload interface → Navigation: renders navigation (evidence: `app/page.tsx`)
- Upload interface → Analysis loader: shows progress (evidence: `app/page.tsx`)
