Skip to content

Building from Source

Niraj Khetre edited this page Nov 25, 2026 · 1 revision

Building from source

You need Node.js 20 or newer and Windows 10 or 11.

git clone https://github.com/nirajkhetre/mondegreen.git
cd mondegreen
npm install
npm start

Scripts

Command What it does
npm start Runs the app from source
npm test Beat tracker checks (several tempos, half-time, a tempo change) and lyrics parsing and clean-up
npm run dist Builds dist/mondegreen-setup-<version>.exe and dist/mondegreen-portable-<version>.exe
npm run art Rebuilds the logo, the Windows icon, and every README, website and wiki image

Debug flags

Command What it does
npm start -- --peek Prints what it hears and a live sync report every 5 s, and saves frames to shots/
npm start -- --peek --demo Plays a built-in demo song and saves every look to shots/<look>-a.png and -b.png
npm start -- --peek --demo --listen Opens listen mode and saves every scene to shots/scene-<name>-a.png and -b.png
npm start -- --peek --demo --listen --scene=texts One scene, plus a burst of six frames

To pretend a song is playing without any music (real lyrics are fetched):

$env:MG_FAKE = "Artist|Title|lengthMs|startMs"; npm start -- --peek

Only one copy of mondegreen runs at a time. Quit the tray app before starting another from source, or the new one exits right away.

Rebuilding the pictures

  1. npm start -- --peek --demo and npm start -- --peek --demo --listen to capture fresh looks and scenes into shots/.
  2. npm run art. It trims the overlay captures, converts the scenes to JPEG, and renders the cards in assets/ (card.html for the banner and social preview, looks.html for the collage) into docs/img/.

The logo is assets/logo.svg (and assets/logo-small.svg for sizes up to 48 px). npm run art -- logo turns them into build/icon.ico, the app's icon.png, and the website's favicons.

Project layout

Path What it is
main.js Windows, tray, shortcuts, settings, the now-playing reader
nowplaying.ps1, control.ps1 Read and control the Windows media session
lyrics.js Kugou and LRCLIB lookups, KRC decoding, caching
beat-worklet.js The beat tracker (AudioWorklet)
live.js The shared song clock, lyrics, colours and beat
engine.js, styles.css, overlay.* The overlay and its twelve looks
listen.*, scenes.js Listen mode and its ten scenes
settings.* The settings window
test/check.js Tests
assets/, tools/render.js Logo and picture sources, and the script that renders them
docs/ The website (GitHub Pages) and every image
wiki/ These wiki pages

Publishing a release

  1. Bump version in package.json.
  2. npm run dist.
  3. Create a GitHub release tagged v<version> and attach both exes from dist/.

Clone this wiki locally