# nguyenbatai30906/melodycore architecture

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

## Overview

MelodyCore contains two standalone music-visualizer applications: the Go/Ebiten visualizer for “Ai Đưa Em Về” and the Rust/SDL2 lyric video for “Phong.” Their workflows start when each app launches, load its timed lyric data and local media, advance lyrics against playback, and render the visuals. The excerpts show the Rust rendering helper directly; Go drawing and timing live in App. The README documents both products. Resource files are represented as local assets; unsampled Go lyric behavior is limited to its indexed reference and excerpt context.

Main entry points: [`phong-rust/src/app.rs`](https://github.com/nguyenbatai30906/melodycore/blob/main/phong-rust/src/app.rs) (Playback App), [`aiduaemve-go/app.go`](https://github.com/nguyenbatai30906/melodycore/blob/main/aiduaemve-go/app.go) (Visualizer App), [`aiduaemve-go/main.go`](https://github.com/nguyenbatai30906/melodycore/blob/main/aiduaemve-go/main.go) (Go Entrypoint), [`phong-rust/src/main.rs`](https://github.com/nguyenbatai30906/melodycore/blob/main/phong-rust/src/main.rs) (Rust Entrypoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_go["Go Visualizer"]
  node_go_entry["Go Entrypoint<br/>[main.go]"]
  node_go_app["Visualizer App<br/>[app.go]"]
  node_go_lyrics["Timed Lyrics<br/>[lyrics.go]"]
  node_go_assets["Audio, Images, Fonts"]
  node_go_output["Rendered Visualizer<br/>[app.go]"]
end

subgraph group_rust["Rust Lyric Video"]
  node_rust_entry["Rust Entrypoint<br/>[main.rs]"]
  node_rust_app["Playback App<br/>[app.rs]"]
  node_rust_lyrics["Timed Lyrics<br/>[lyrics.rs]"]
  node_rust_gfx["Text and Effects<br/>[gfx.rs]"]
  node_rust_assets["Audio, Images, Fonts"]
  node_rust_images["Background Images"]
  node_rust_output["Rendered Lyric Video<br/>[app.rs]"]
end

node_viewer(("Viewer"))

node_viewer -->|"launches"| node_go_entry
node_go_entry -->|"starts"| node_go_app
node_go_app -->|"loads verses"| node_go_lyrics
node_go_app -->|"loads media"| node_go_assets
node_go_app -->|"draws frames"| node_go_output
node_viewer -->|"launches"| node_rust_entry
node_rust_entry -->|"runs"| node_rust_app
node_rust_app -->|"loads verses"| node_rust_lyrics
node_rust_app -->|"loads audio"| node_rust_assets
node_rust_app -->|"loads textures"| node_rust_images
node_rust_app -->|"renders text"| node_rust_gfx
node_rust_gfx -->|"resolves fonts"| node_rust_lyrics
node_rust_app -->|"presents frames"| node_rust_output

click node_go_entry "https://github.com/nguyenbatai30906/melodycore/blob/main/aiduaemve-go/main.go"
click node_go_app "https://github.com/nguyenbatai30906/melodycore/blob/main/aiduaemve-go/app.go"
click node_go_lyrics "https://github.com/nguyenbatai30906/melodycore/blob/main/aiduaemve-go/lyrics.go"
click node_go_assets "https://github.com/nguyenbatai30906/melodycore/tree/main/aiduaemve-go/resources"
click node_go_output "https://github.com/nguyenbatai30906/melodycore/blob/main/aiduaemve-go/app.go"
click node_rust_entry "https://github.com/nguyenbatai30906/melodycore/blob/main/phong-rust/src/main.rs"
click node_rust_app "https://github.com/nguyenbatai30906/melodycore/blob/main/phong-rust/src/app.rs"
click node_rust_lyrics "https://github.com/nguyenbatai30906/melodycore/blob/main/phong-rust/src/lyrics.rs"
click node_rust_gfx "https://github.com/nguyenbatai30906/melodycore/blob/main/phong-rust/src/gfx.rs"
click node_rust_assets "https://github.com/nguyenbatai30906/melodycore/tree/main/phong-rust/resources"
click node_rust_images "https://github.com/nguyenbatai30906/melodycore/tree/main/phong-rust/img"
click node_rust_output "https://github.com/nguyenbatai30906/melodycore/blob/main/phong-rust/src/app.rs"

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_go_entry,node_go_app,node_go_lyrics,node_go_assets,node_go_output,node_viewer toneBlue
class node_rust_entry,node_rust_app,node_rust_lyrics,node_rust_gfx,node_rust_assets,node_rust_images,node_rust_output toneAmber
```

## Components

### Go Visualizer

- [Go Entrypoint](https://github.com/nguyenbatai30906/melodycore/blob/main/aiduaemve-go/main.go): `aiduaemve-go/main.go`
- [Visualizer App](https://github.com/nguyenbatai30906/melodycore/blob/main/aiduaemve-go/app.go): `aiduaemve-go/app.go`
- [Timed Lyrics](https://github.com/nguyenbatai30906/melodycore/blob/main/aiduaemve-go/lyrics.go): `aiduaemve-go/lyrics.go`
- [Audio, Images, Fonts](https://github.com/nguyenbatai30906/melodycore/tree/main/aiduaemve-go/resources): `aiduaemve-go/resources`
- [Rendered Visualizer](https://github.com/nguyenbatai30906/melodycore/blob/main/aiduaemve-go/app.go): `aiduaemve-go/app.go`

### Rust Lyric Video

- [Rust Entrypoint](https://github.com/nguyenbatai30906/melodycore/blob/main/phong-rust/src/main.rs): `phong-rust/src/main.rs`
- [Playback App](https://github.com/nguyenbatai30906/melodycore/blob/main/phong-rust/src/app.rs): `phong-rust/src/app.rs`
- [Timed Lyrics](https://github.com/nguyenbatai30906/melodycore/blob/main/phong-rust/src/lyrics.rs): `phong-rust/src/lyrics.rs`
- [Text and Effects](https://github.com/nguyenbatai30906/melodycore/blob/main/phong-rust/src/gfx.rs): `phong-rust/src/gfx.rs`
- [Audio, Images, Fonts](https://github.com/nguyenbatai30906/melodycore/tree/main/phong-rust/resources): `phong-rust/resources`
- [Background Images](https://github.com/nguyenbatai30906/melodycore/tree/main/phong-rust/img): `phong-rust/img`
- [Rendered Lyric Video](https://github.com/nguyenbatai30906/melodycore/blob/main/phong-rust/src/app.rs): `phong-rust/src/app.rs`

### Other components

- **Viewer**

## Connections

- Viewer → Go Entrypoint: launches (evidence: `README.md`)
- Go Entrypoint → Visualizer App: starts (evidence: `aiduaemve-go/main.go`)
- Visualizer App → Timed Lyrics: loads verses (evidence: `aiduaemve-go/app.go`)
- Visualizer App → Audio, Images, Fonts: loads media (evidence: `aiduaemve-go/app.go`)
- Visualizer App → Rendered Visualizer: draws frames (evidence: `aiduaemve-go/app.go`)
- Viewer → Rust Entrypoint: launches (evidence: `README.md`)
- Rust Entrypoint → Playback App: runs (evidence: `phong-rust/src/main.rs`)
- Playback App → Timed Lyrics: loads verses (evidence: `phong-rust/src/app.rs`)
- Playback App → Audio, Images, Fonts: loads audio (evidence: `phong-rust/src/app.rs`)
- Playback App → Background Images: loads textures (evidence: `phong-rust/src/app.rs`)
- Playback App → Text and Effects: renders text (evidence: `phong-rust/src/app.rs`)
- Text and Effects → Timed Lyrics: resolves fonts (evidence: `phong-rust/src/gfx.rs`)
- Playback App → Rendered Lyric Video: presents frames (evidence: `phong-rust/src/app.rs`)
