Ambient music generator that sonifies git repository activity. Turn your commit history into music.
Code DJ analyzes recent git activity and maps it to musical elements:
| Git Metric | Musical Element |
|---|---|
| Commit count | Tempo (more commits = faster notes) |
| Insertion/deletion ratio | Pitch (more insertions = higher octave) |
| File types | Instrument timbre (see below) |
| Merge conflicts | Minor key + dissonant detuned notes |
| No conflicts | Major key, happy progression |
Different file extensions produce different synthesizer waveforms:
| Extension | Waveform | Sound Character |
|---|---|---|
.ts, .js |
Sine | Smooth, clean synth |
.rs, .go |
Square | Punchy, 8-bit bass |
.md, .txt |
Triangle | Soft, mellow pad |
| Other | Sawtooth | Bright, edgy lead |
The generator creates a 4-bar loop with a 4-chord progression per bar:
- No conflicts (major):
I - IV - V - I(happy, resolved) - Conflicts (minor):
i - v - iv - v(tense, unresolved)
Each chord is built from the scale:
- Major: C D E F G A B (intervals: 0 2 4 5 7 9 11)
- Minor: C D Eb F G Ab Bb (intervals: 0 2 3 5 7 8 10)
Bass notes hit on beats 1 and 3. Arpeggio accents are added based on commit count.
All audio is synthesized from scratch - no samples or external dependencies.
- Oscillator: Generates raw waveforms (sine/square/sawtooth/triangle)
- Envelope: ADSR-like amplitude shaping (10% attack, 30% release)
- Mixer: Sums multiple oscillators for chords
- Normalizer: Prevents clipping
Outputs standard PCM WAV:
- Sample rate: 44100 Hz
- Bit depth: 16-bit signed
- Channels: Mono
deno run -A main.ts <repo-path> [since]# Last hour of current directory
deno run -A main.ts .
# Last 24 hours of a specific repo
deno run -A main.ts /path/to/repo "24 hours ago"
# Last week
deno run -A main.ts . "1 week ago"🎵 Code DJ - Generating music from git activity
Repo: /path/to/repo
Since: 24 hours ago
📊 Git Stats:
Commits: 9
Insertions: 4778
Deletions: 4632
Files changed: 39
Authors: alice, bob, charlie
Conflicts: ✅ No
🎹 Generating music...
✅ Saved to /tmp/code-dj/output.wav
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ git log │────▶│ GitStats │────▶│ generateMusic()
│ git status │ │ - commits │ │ - pick scale
└─────────────┘ │ - ins/del │ │ - build chords
│ - files │ │ - mix waveforms
│ - conflicts │ └───────┬─────┘
└──────────────┘ │
▼
┌──────────────┐ ┌─────────────┐
│ output.wav │◀────│ toWav() │
└──────────────┘ └─────────────┘
Because code has rhythm. A repo with steady commits has a pulse. Merge conflicts are dissonant. A big refactor sounds different than small bug fixes.
Also it's fun.
MIT