explaingit

crossrobertj/ninmidi

1HTMLAudience · generalComplexity · 1/5ActiveSetup · easy

TLDR

Single HTML file that generates MIDI patterns inspired by 14 Nine Inch Nails albums, with a piano roll, Web Audio playback, and .mid export, all running locally in the browser.

Mindmap

mindmap
  root((ninmidi))
    Inputs
      Album preset
      Track type
      Piano roll edits
    Outputs
      MIDI file
      JSON snapshot
      Shareable URL
    Use Cases
      Sketch industrial beats
      Export MIDI to a DAW
      Generate dark drum patterns
      Share patterns via URL
    Tech Stack
      HTML
      JavaScript
      WebAudio

Things people build with this

USE CASE 1

Generate NIN-inspired drum, bass, melody, arpeggio, or pad patterns offline

USE CASE 2

Lock one track and regenerate the others around it on the piano roll

USE CASE 3

Export finished patterns as .mid files for use in a DAW

USE CASE 4

Share a session by copying the URL that encodes the pattern in its hash

Tech stack

HTMLJavaScriptWebAudio

Getting it running

Difficulty · easy Time to first run · 5min

In plain English

NIN MIDI Generator is a single HTML file that produces MIDI patterns inspired by the discography of the band Nine Inch Nails. You download one file, open it in a normal web browser like Chrome, Firefox, Edge, or Safari, and the whole tool runs locally inside the page. There is no install step, no server to set up, and no internet connection needed after the file is on your computer. The generator covers 14 NIN albums, from Pretty Hate Machine in 1989 through Ghosts VI: Locusts in 2020. Each album acts as a preset that sets a tempo range, a set of musical scales, a drum density, and a dissonance level, so picking an album steers the sound toward that record's character. You can generate seven kinds of tracks, including drums, bass, melody, arpeggio, pad or chords, and a full pattern that fills every track at once. The page shows an interactive piano roll where notes appear as color coded blocks. You can click to toggle notes on or off, drag to draw, right click to delete, scroll to zoom, and audition drum sounds by clicking pads. Each track can be locked, so you can keep a bassline you like and regenerate only the drums around it. Playback runs through the browser's built in Web Audio system, with three knobs for distortion, delay, and reverb, plus a real time waveform display. Finished patterns can be exported as standard .mid files for use in other music software, or as JSON snapshots that capture the full session including history. Sessions also save automatically to the browser's local storage, and patterns can be shared by copying a URL that encodes the pattern in its hash.

Copy-paste prompts

Prompt 1
Walk me through opening ninmidi.html in Chrome and generating a Pretty Hate Machine drum pattern
Prompt 2
Explain how the album preset changes tempo range, scales, drum density, and dissonance
Prompt 3
Show me how to lock the bass track and regenerate only the melody around it
Prompt 4
Help me export a pattern as a .mid file and import it into Ableton
Prompt 5
Tell me how the URL hash sharing encodes the full pattern state
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.