# shadowhedgehog76/pulsekeys architecture

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

- Interactive diagram: https://gitdiagram.com/shadowhedgehog76/pulsekeys
- Repository: https://github.com/shadowhedgehog76/pulsekeys

## Overview

PULSE//KEYS is a browser-based rhythm game: players choose a song or an endless mode, play timed note charts, and view results or continue a run. Song composition and chart generation are procedural; gameplay handles timing, judgement, scoring, and rendering, while Web Audio synthesizes the music and effects. The excerpts are partial, so the graph shows only supported runtime connections and omits uncertain wiring.

Main entry points: [`js/main.js`](https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/main.js) (App controller), [`js/game.js`](https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/game.js) (Game session), [`js/audio.js`](https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/audio.js) (Audio engine), [`js/endless.js`](https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/endless.js) (Endless runs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Game experience"]
  node_ui["Game screens<br/>[index.html]"]
  node_app["App controller<br/>[main.js]"]
  node_results["Results and scores<br/>[main.js]"]
  node_endless["Endless runs<br/>[endless.js]"]
end

subgraph group_content["Music and charts"]
  node_songs["Songs and charts<br/>[songs.js]"]
end

subgraph group_runtime["Play runtime"]
  node_game["Game session<br/>[game.js]"]
  node_calibration["Input calibration<br/>[main.js]"]
  node_audio["Audio engine<br/>[audio.js]"]
  node_backgrounds["Animated backgrounds<br/>[bg.js]"]
  node_utilities["Shared utilities<br/>[util.js]"]
end

subgraph group_platform["Browser services"]
  node_storage[("Browser storage")]
  node_webaudio["Web Audio API"]
  node_canvas["Canvas rendering"]
end

node_player(("Player"))

node_player -->|"uses"| node_ui
node_ui -->|"dispatches input"| node_app
node_app -->|"lists songs"| node_songs
node_app -->|"starts session"| node_game
node_app -->|"starts run"| node_endless
node_app -->|"opens calibration"| node_calibration
node_app -->|"reads/writes settings"| node_storage
node_app -->|"records results"| node_results
node_game -->|"builds chart"| node_songs
node_game -->|"plays music"| node_audio
node_game -->|"draws background"| node_backgrounds
node_game -->|"renders session"| node_canvas
node_game -->|"reports completion"| node_app
node_endless -->|"starts segments"| node_game
node_endless -->|"updates run screens"| node_app
node_endless -->|"saves records"| node_storage
node_calibration -->|"starts metronome"| node_audio
node_audio -->|"synthesizes sound"| node_webaudio
node_audio -->|"uses helpers"| node_utilities
node_songs -->|"uses seeded generation"| node_utilities
node_backgrounds -->|"draws effects"| node_canvas
node_app -->|"plays menu audio"| node_audio
node_app -->|"draws menu background"| node_backgrounds

click node_ui "https://github.com/shadowhedgehog76/pulsekeys/blob/main/index.html"
click node_app "https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/main.js"
click node_results "https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/main.js"
click node_endless "https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/endless.js"
click node_songs "https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/songs.js"
click node_game "https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/game.js"
click node_calibration "https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/main.js"
click node_audio "https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/audio.js"
click node_backgrounds "https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/bg.js"
click node_utilities "https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/util.js"

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_ui,node_app,node_results,node_endless toneBlue
class node_songs toneAmber
class node_game,node_calibration,node_audio,node_backgrounds,node_utilities toneMint
class node_storage,node_webaudio,node_canvas toneRose
class node_player toneIndigo
```

## Components

### Game experience

- [Game screens](https://github.com/shadowhedgehog76/pulsekeys/blob/main/index.html): `index.html`
- [App controller](https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/main.js): `js/main.js`
- [Results and scores](https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/main.js): `js/main.js`
- [Endless runs](https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/endless.js): `js/endless.js`

### Music and charts

- [Songs and charts](https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/songs.js): `js/songs.js`

### Play runtime

- [Game session](https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/game.js): `js/game.js`
- [Input calibration](https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/main.js): `js/main.js`
- [Audio engine](https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/audio.js): `js/audio.js`
- [Animated backgrounds](https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/bg.js): `js/bg.js`
- [Shared utilities](https://github.com/shadowhedgehog76/pulsekeys/blob/main/js/util.js): `js/util.js`

### Browser services

- **Browser storage**
- **Web Audio API**
- **Canvas rendering**

### Other components

- **Player**

## Connections

- Player → Game screens: uses
- Game screens → App controller: dispatches input
- App controller → Songs and charts: lists songs
- App controller → Game session: starts session
- App controller → Endless runs: starts run
- App controller → Input calibration: opens calibration
- App controller → Browser storage: reads/writes settings
- App controller → Results and scores: records results
- Game session → Songs and charts: builds chart
- Game session → Audio engine: plays music
- Game session → Animated backgrounds: draws background
- Game session → Canvas rendering: renders session
- Game session → App controller: reports completion
- Endless runs → Game session: starts segments
- Endless runs → App controller: updates run screens
- Endless runs → Browser storage: saves records
- Input calibration → Audio engine: starts metronome
- Audio engine → Web Audio API: synthesizes sound
- Audio engine → Shared utilities: uses helpers
- Songs and charts → Shared utilities: uses seeded generation
- Animated backgrounds → Canvas rendering: draws effects
- App controller → Audio engine: plays menu audio
- App controller → Animated backgrounds: draws menu background
