What counts as a version
Timing comes first, and it isn't part of the energy. Onsets are pulled to the 8th-note grid, swung at 56 % like the hats. Distances to a beat count three quarters, so a beat pulls harder than an offbeat: a note has to sit clearly off the beat to land between beats. Two notes played less than 1.6 sixteenths apart are a flam: one takes the 8th, the other the 16th beside it. Ends snap to 16ths. The dot fades all of this in, from the far left to 30 %.
Then every note gets options: stay, move one or two semitones up or down (up to four once the dot passes 30 %), or be deleted. Twelve notes with ten options each are 1012 versions. The pad doesn't sample them or guess. It finds the cheapest one exactly, as the next sections show.
The energy, term by term
Units are "one soft semitone move". First, every note gets a stiffness: how much it resists being changed.
- how confidently the note was sung, ranked within the line, 0 to 1. A keyboard can't be unsure: every played note ties at 0.
- how many other notes share its pitch class, up to 3. A note you play twice is an idea.
- its length in beats, up to 1.
- 1.2 if it starts on a beat, else 1.
- the dot's weight on changing your notes (table below).
Moving a note by δ semitones costs its stiffness times a price that grows faster than the distance: one semitone 1, two 3, four 7.
The discount is zero or negative: moving toward where the voice actually was is cheaper than moving away. A hum sung 30 cents sharp goes up more easily than down. From a keyboard there's no voice, and it's zero.
A note outside the key (A minor here) costs more the longer it lasts and the stronger its beat:
- the note's length in beats.
- 1.3 on a beat, 1 on an 8th, 0.7 on a 16th.
- 0.1 for G♯, the leading tone of A minor, the commonest colour note in minor tunes; 1 for the rest. Six G♯s once read as another key; now they're a tenth of a wrong note.
A rub against what else sounds, the bass or another melody, is the one thing that sounds like a mistake in any genre:
- 1 for a semitone or a minor ninth, 0.6 for a semitone rub further apart, 0.5 for a major seventh inside the octave, 0 for everything else. Pitches as heard, after the octave rule puts the line on its instrument.
- how long the two overlap, in beats; under 40 ms doesn't count.
A note off the bar's chord costs only once the dot passes 30 %, and only as much as it's exposed:
where is 1 on a beat, 0.35 on an 8th and 0.15 on a 16th. A passing 16th can sit off the chord all day; a long note on the one can't. The chord is the bar's root with its third, fifth and seventh, here A, C, E and G; from 55 % the seventh no longer counts.
Deleting a note must never be the cheap way around the key or the chord, so it gets dearer as the chord pull grows. A note that looks like an accident is the exception: short and quiet, or short and seven semitones from both neighbours.
Here runs from 0 to 1, how much the note looks like an accident, and keeping one costs .
Between neighbours, two terms. The contour guard: a step up stays up, a step down stays down, a repeat stays a repeat, with one exception, a semitone step may settle into a repeat, because voices overshoot and settle. And a rub that resolves by step is 60 % forgiven, a short off-beat passing note that steps into the key entirely.
where is 1 for a short off-beat note (a quarter second or less) whose next note is in the key, else 0. Add it all up:
How wrong it sounds is . How far it moved is . The demo above shows both, live.
The dot sets the weights
The dot never picks notes. It moves three weights and a couple of switches, and the search does the rest. Up to 30 % the fit reads the dot as it is; from there 45 % reads as 0.4 and 60 % as 1, where the weights stop changing.
| Dot | stiffness | key | chord | moves | and | |
|---|---|---|---|---|---|---|
| 0–4 % | – | nothing is weighed: the line plays as it came in | ||||
| 15 % | 0.15 | 2.64 | 0.95 | 0 | ±2 | timing half-way to the grid |
| 29 % | 0.29 | 1.79 | 1.37 | 0 | ±2 | a wrong note still costs little |
| 30 % | 0.30 | 1.74 | 10 | 0 | ±4 | a fresh dot: in key, on the beat, every note kept |
| 45 % | 0.40 | 1.32 | 10 | 3 | ±4 | exposed notes pulled onto the chord |
| 55 % | 0.80 | 0.44 | 10 | 3 | ±4 | the chord is a triad now; half the thinning |
| 60–100 % | 1 | 0.25 | 10 | 3 | ±4 | all the thinning, then the freedom moves |
Look at the jump between 29 % and 30 %. Left of it a wrong note is a mild preference; from 30 % it costs ten times the base weight, which in practice is a rule. That's on purpose: people hum wrong notes into Brumm's silent loop, so a fresh dot starts at 30 % with every note in key and on the beat, and only the far left is exactly as played.
Solved exactly
Because every cost depends on one note or on two neighbours, the cheapest line is a shortest path through a graph whose nodes are (note, option) pairs. Dynamic programming walks it once:
- the cheapest way to play notes 1 to j with note j kept as option o.
- that note's own terms: M + K + X + C + 3a.
- the cost of deleting every note in between.
The work grows with the square of the note count: twelve notes with nine kept options each are about 5,000 links, thirty notes about 35,000. The demo tells you how long it took on your device.
Brumm runs the search twice. The first pass decides what you meant: how to read a hum sung between two semitones and, where the key may move, which key. It uses a fixed balance tuned on Daniel's hums, whatever the dot says. The second pass corrects inside that reading with the dot's weights. A line played on a keyboard leaves the first pass nothing to decide.
Temperature
At zero temperature the pad always plays the ground state. Same line, same dot, same notes, every time. That's what you want from an instrument most of the time, and it gets boring the rest of the time. A temperature draws a line instead of taking the best one:
Versions close to the ground state get a real chance, versions far above it practically none. The catch is that is a sum over 1012 lines, and nobody lists them. The same recursion does it, with the minimum replaced by a soft minimum:
That's a transfer matrix, the way statistical physics sums over a chain of spins. Run forward, it gives the partition function. Walk back from the end, drawing each step by its weight, and the line comes out with exactly its Boltzmann probability. No Markov chain, no burn-in. As the soft minimum becomes the minimum and the ground state is back.
The demo's keyboard line has a nice case at 30 %. Its C♯ can go to C or to D, and its F♯ to F or to G, all for exactly the same price: four ground states with one energy, which physicists call degenerate. At zero temperature the search keeps the first it finds, the step down each time. Any temperature above zero picks among the four with equal odds.
Quantum physics allows you to fall through your chair. Absurdly unlikely: paint one atom of the Earth red, pick an atom at random with your eyes closed, and hitting the red one is likelier than falling through your chair within a million years.
The temperature works the same way. An unlikely line is never forbidden, only weighted. Turn it up a little and you get bolder lines a few units above the ground state. Turn it all the way and the many slightly wrong lines outnumber the few right ones: they win by count, not by energy. Physicists call that entropy. Musicians call it a jam that went on too long.
Like everything in the fit, the temperature only moves notes. It never touches the sound.
Not everything is physics
Two things happen after the fit, and they're rules, not energy. Past 50 % the weakest notes leave one at a time as the dot moves: off-beat and short notes first, the first note of each bar always stays, never more than half the line and never below six notes. They used to go as an energy choice, all at once; Daniel wanted them to leave one by one.
From 60 % the fit's weights stop changing, and the far right hands the line some freedom, in this order as the dot goes right: a passing note before a big leap, a repeat into a gap, a single note jumping an octave toward the middle of the phrase, a note on a beat pushed onto the offbeat. All of it deterministic. The energy in the demo is the fit's; the lines under it say what the rules did.
Where it's weak
- It needs the whole phrase. The contour, the thinning and the freedom look at the line from first note to last, so the pad hears a loop once and bends it from its second pass.
- Two modes. Natural minor and Dorian. A line in major reads as its relative minor, same notes, so the pitches come out right and the name is wrong.
- One chord per bar. The chord pull knows a root per bar, no more.
- Tuned on hums. A short, quiet note counts as an accident and is cheap to delete. Right for a hum's glitch, wrong for a ghost note you meant.
- No rhythm in the energy. Timing is snapped first, then pitch is weighed. A version that moves a note in time is not a candidate.
None of that is a law of nature. Daniel's line on physics covers it: it's not truth, it's the best you have. He also says a formula that explained the universe exactly would be the universe itself. A formula that explained music exactly would be music, and nobody needs a plugin for that.

Who wrote it down
The idea of writing music theory down as an energy is Daniel Breyer's. He studied theoretical quantum physics and published a paper in Physical Review A, on light scattering in an optomechanical cavity coupled to a single atom. He has been writing everything down as an energy since. AI agents wrote the code; his ears set the numbers.
The demo runs Brumm's fit in its own setting, a two-bar loop at 123 BPM in A minor over Brumm's bass. In the pad, the tempo and the loop come from your DAW. The pad comes out on 10 December, free and open source under GPL-3, this energy included.
