# sudevsamuel07/music-genre-lyric-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/sudevsamuel07/music-genre-lyric-analyzer
- Repository: https://github.com/sudevsamuel07/music-genre-lyric-analyzer

## Overview

This is a Flask music-analysis application: a user submits audio by upload or URL, then receives a predicted genre and a lyrics transcript in the web interface. The analysis path combines MFCC extraction and CNN inference with Whisper transcription. The separate training script builds and saves the genre model. The README documents capabilities such as format support, segment voting, and model caching; some are not separate modules in the sampled source. The referenced data.json mapping is absent from the supplied tree, so its storage is not shown.

Main entry points: [`app.py`](https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/app.py) (Flask analysis route), [`feature_extractor_py_(with_kagglehub).py`](https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/feature_extractor_py_(with_kagglehub).py) (CNN training script), [`features.py`](https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/features.py) (Segment genre voting), [`genre_classifier.h5`](https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/genre_classifier.h5) (Trained CNN model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workflow"]
  node_flask["Flask analysis route<br/>[app.py]"]
  node_input["Audio input staging<br/>[app.py]"]
  node_uploads["Uploaded audio files"]
  node_template["Analysis interface<br/>[index.html]"]
end

subgraph group_genre["Genre analysis"]
  node_mfcc["MFCC extraction<br/>[features.py]"]
  node_mapping["Genre mapping loader<br/>[features.py]"]
  node_inference["Segment genre voting<br/>[features.py]"]
  node_model["Trained CNN model"]
end

subgraph group_lyrics["Lyrics transcription"]
  node_transcriber["Whisper transcription<br/>[features.py]"]
end

subgraph group_training["Model training"]
  node_trainer["CNN training script"]
end

node_user(("User"))
node_url_source["Remote audio URL"]
node_whisper["Whisper library"]

node_user -->|"submits audio"| node_flask
node_flask -->|"stages input"| node_input
node_input -->|"saves file"| node_uploads
node_input -->|"downloads audio"| node_url_source
node_flask -->|"extracts features"| node_mfcc
node_flask -->|"loads mapping"| node_mapping
node_flask -->|"predicts genre"| node_inference
node_inference -.->|"runs inference"| node_model
node_flask -->|"requests transcript"| node_transcriber
node_transcriber -->|"transcribes audio"| node_whisper
node_flask -->|"renders results"| node_template
node_trainer -->|"saves model"| node_model
node_trainer -.->|"extracts features"| node_mfcc

click node_flask "https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/app.py"
click node_input "https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/app.py"
click node_uploads "https://github.com/sudevsamuel07/music-genre-lyric-analyzer/tree/main/uploads"
click node_template "https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/templates/index.html"
click node_mfcc "https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/features.py"
click node_mapping "https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/features.py"
click node_inference "https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/features.py"
click node_model "https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/genre_classifier.h5"
click node_transcriber "https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/features.py"
click node_trainer "https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/feature_extractor_py_(with_kagglehub).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_flask,node_input,node_uploads,node_template,node_user toneBlue
class node_mfcc,node_mapping,node_inference,node_model toneAmber
class node_transcriber toneMint
class node_trainer toneRose
class node_url_source,node_whisper toneIndigo
```

## Components

### Web workflow

- [Flask analysis route](https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/app.py): `app.py`
- [Audio input staging](https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/app.py): `app.py`
- [Uploaded audio files](https://github.com/sudevsamuel07/music-genre-lyric-analyzer/tree/main/uploads): `uploads`
- [Analysis interface](https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/templates/index.html): `templates/index.html`

### Genre analysis

- [MFCC extraction](https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/features.py): `features.py`
- [Genre mapping loader](https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/features.py): `features.py`
- [Segment genre voting](https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/features.py): `features.py`
- [Trained CNN model](https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/genre_classifier.h5): `genre_classifier.h5`

### Lyrics transcription

- [Whisper transcription](https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/features.py): `features.py`

### Model training

- [CNN training script](https://github.com/sudevsamuel07/music-genre-lyric-analyzer/blob/main/feature_extractor_py_(with_kagglehub).py): `feature_extractor_py_(with_kagglehub).py`

### Other components

- **User**
- **Remote audio URL**
- **Whisper library**

## Connections

- User → Flask analysis route: submits audio (evidence: `app.py`)
- Flask analysis route → Audio input staging: stages input (evidence: `app.py`)
- Audio input staging → Uploaded audio files: saves file (evidence: `app.py`)
- Audio input staging → Remote audio URL: downloads audio (evidence: `app.py`)
- Flask analysis route → MFCC extraction: extracts features (evidence: `app.py`)
- Flask analysis route → Genre mapping loader: loads mapping (evidence: `app.py`)
- Flask analysis route → Segment genre voting: predicts genre (evidence: `app.py`)
- Segment genre voting → Trained CNN model: runs inference (evidence: `README.md`)
- Flask analysis route → Whisper transcription: requests transcript (evidence: `app.py`)
- Whisper transcription → Whisper library: transcribes audio (evidence: `features.py`)
- Flask analysis route → Analysis interface: renders results (evidence: `app.py`)
- CNN training script → Trained CNN model: saves model (evidence: `feature_extractor_py_(with_kagglehub).py`)
- CNN training script → MFCC extraction: extracts features
