# by-hahn/music-recognition-app architecture

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

- Interactive diagram: https://gitdiagram.com/by-hahn/music-recognition-app
- Repository: https://github.com/by-hahn/music-recognition-app

## Overview

This is a Tkinter desktop music-recognition app. The main workflow is: a user starts recognition, the app records microphone audio, sends it to AudD, enriches a match with Spotify metadata, then displays and saves the result. My Page presents saved history in list and calendar views; the app also synchronizes themes across windows and seeds/reveals a first-run mystery entry. The graph follows documented capabilities where implementation excerpts are incomplete; edges are limited to relationships visible in excerpts or stated in the README.

Main entry points: [`ui/main_window.py`](https://github.com/by-hahn/music-recognition-app/blob/main/ui/main_window.py) (App coordinator), [`ui/search_window.py`](https://github.com/by-hahn/music-recognition-app/blob/main/ui/search_window.py) (Result window), [`ui/mypage_window.py`](https://github.com/by-hahn/music-recognition-app/blob/main/ui/mypage_window.py) (History views), [`database.py`](https://github.com/by-hahn/music-recognition-app/blob/main/database.py) (SQLite history)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_recognition["Recognition"]
  node_app["App coordinator<br/>[main_window.py]"]
  node_audio["Audio capture<br/>[main_window.py]"]
  node_audd["AudD recognition<br/>[music_api.py]"]
  node_spotify["Spotify metadata<br/>[music_api.py]"]
end

subgraph group_results["Results and history"]
  node_result["Result window<br/>[search_window.py]"]
  node_database[("SQLite history<br/>[database.py]")]
  node_logs["Daily JSON logs<br/>[database.py]"]
  node_mypage["History views<br/>[mypage_window.py]"]
end

subgraph group_presentation["Window presentation"]
  node_theme["Theme system<br/>[theme.py]"]
  node_clock["Analog clock<br/>[analog_clock.py]"]
end

subgraph group_extras["Personal touches"]
  node_egg_seed["Mystery entry seed<br/>[easter_egg.py]"]
  node_egg_reveal["Mystery entry reveal"]
end

node_user(("User"))
node_microphone(("Microphone"))
node_services["Music APIs"]
node_browser["Web browser"]

node_user -->|"starts search"| node_app
node_app -->|"starts capture"| node_audio
node_microphone -->|"provides audio"| node_audio
node_audio -->|"sends recording"| node_audd
node_audd -->|"identifies track"| node_services
node_app -->|"fetches details"| node_spotify
node_spotify -->|"queries track"| node_services
node_app -->|"opens result"| node_result
node_result -->|"saves result"| node_database
node_result -->|"saves result"| node_logs
node_user -->|"opens history"| node_mypage
node_mypage -->|"reads history"| node_logs
node_mypage -->|"queries dates"| node_database
node_app -->|"toggles theme"| node_theme
node_theme -->|"updates appearance"| node_clock
node_database -->|"seeds on setup"| node_egg_seed
node_mypage -->|"checks selected entry"| node_egg_reveal
node_egg_reveal -->|"opens bonus link"| node_browser
node_result -->|"opens track links"| node_browser

click node_app "https://github.com/by-hahn/music-recognition-app/blob/main/ui/main_window.py"
click node_audio "https://github.com/by-hahn/music-recognition-app/blob/main/ui/main_window.py"
click node_audd "https://github.com/by-hahn/music-recognition-app/blob/main/music_api.py"
click node_spotify "https://github.com/by-hahn/music-recognition-app/blob/main/music_api.py"
click node_result "https://github.com/by-hahn/music-recognition-app/blob/main/ui/search_window.py"
click node_database "https://github.com/by-hahn/music-recognition-app/blob/main/database.py"
click node_logs "https://github.com/by-hahn/music-recognition-app/blob/main/database.py"
click node_mypage "https://github.com/by-hahn/music-recognition-app/blob/main/ui/mypage_window.py"
click node_theme "https://github.com/by-hahn/music-recognition-app/blob/main/theme.py"
click node_clock "https://github.com/by-hahn/music-recognition-app/blob/main/ui/analog_clock.py"
click node_egg_seed "https://github.com/by-hahn/music-recognition-app/blob/main/easter_egg.py"
click node_egg_reveal "https://github.com/by-hahn/music-recognition-app/blob/main/easter_egg_popup.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_app,node_audio,node_audd,node_spotify,node_user,node_browser toneBlue
class node_result,node_database,node_logs,node_mypage toneAmber
class node_theme,node_clock,node_services toneMint
class node_egg_seed,node_egg_reveal toneRose
class node_microphone toneIndigo
```

## Components

### Recognition

- [App coordinator](https://github.com/by-hahn/music-recognition-app/blob/main/ui/main_window.py): `ui/main_window.py`
- [Audio capture](https://github.com/by-hahn/music-recognition-app/blob/main/ui/main_window.py): `ui/main_window.py`
- [AudD recognition](https://github.com/by-hahn/music-recognition-app/blob/main/music_api.py): `music_api.py`
- [Spotify metadata](https://github.com/by-hahn/music-recognition-app/blob/main/music_api.py): `music_api.py`

### Results and history

- [Result window](https://github.com/by-hahn/music-recognition-app/blob/main/ui/search_window.py): `ui/search_window.py`
- [SQLite history](https://github.com/by-hahn/music-recognition-app/blob/main/database.py): `database.py`
- [Daily JSON logs](https://github.com/by-hahn/music-recognition-app/blob/main/database.py): `database.py`
- [History views](https://github.com/by-hahn/music-recognition-app/blob/main/ui/mypage_window.py): `ui/mypage_window.py`

### Window presentation

- [Theme system](https://github.com/by-hahn/music-recognition-app/blob/main/theme.py): `theme.py`
- [Analog clock](https://github.com/by-hahn/music-recognition-app/blob/main/ui/analog_clock.py): `ui/analog_clock.py`

### Personal touches

- [Mystery entry seed](https://github.com/by-hahn/music-recognition-app/blob/main/easter_egg.py): `easter_egg.py`
- [Mystery entry reveal](https://github.com/by-hahn/music-recognition-app/blob/main/easter_egg_popup.py): `easter_egg_popup.py`

### Other components

- **User**
- **Microphone**
- **Music APIs**
- **Web browser**

## Connections

- User → App coordinator: starts search (evidence: `README.md`)
- App coordinator → Audio capture: starts capture (evidence: `ui/main_window.py`)
- Microphone → Audio capture: provides audio (evidence: `README.md`)
- Audio capture → AudD recognition: sends recording (evidence: `ui/main_window.py`)
- AudD recognition → Music APIs: identifies track (evidence: `README.md`)
- App coordinator → Spotify metadata: fetches details (evidence: `ui/main_window.py`)
- Spotify metadata → Music APIs: queries track (evidence: `README.md`)
- App coordinator → Result window: opens result (evidence: `ui/main_window.py`)
- Result window → SQLite history: saves result (evidence: `ui/search_window.py`)
- Result window → Daily JSON logs: saves result (evidence: `README.md`)
- User → History views: opens history (evidence: `README.md`)
- History views → Daily JSON logs: reads history (evidence: `ui/mypage_window.py`)
- History views → SQLite history: queries dates (evidence: `ui/mypage_window.py`)
- App coordinator → Theme system: toggles theme (evidence: `ui/main_window.py`)
- Theme system → Analog clock: updates appearance (evidence: `theme.py`)
- SQLite history → Mystery entry seed: seeds on setup (evidence: `database.py`)
- History views → Mystery entry reveal: checks selected entry (evidence: `ui/mypage_window.py`)
- Mystery entry reveal → Web browser: opens bonus link (evidence: `easter_egg_popup.py`)
- Result window → Web browser: opens track links (evidence: `ui/search_window.py`)
