Skip to content

MilkDrop: a preset generator of our own (#579, part 1) - #609

Merged
CaYatur merged 4 commits into
mainfrom
milkdrop/generator-579
Sep 23, 2026
Merged

CaYatur merged 4 commits into
mainfrom
milkdrop/generator-579

Conversation

@CaYatur

@CaYatur CaYatur commented Sep 22, 2026

Copy link
Copy Markdown
Owner

The first half of #579: a MilkDrop preset generator of our own. Mash-ups come in a second PR.

What it does

Studio → MilkDrop Preset Generator: four sliders (energy, warmth, density, motion) and a seed write an original .milk.

  • Six motion patterns, six wave patterns and four shape patterns.
  • Four composite and two warp shaders.
  • All of it written in this repository, in MilkDrop 2's file format. Version lines only when there is a shader.

Preview, save and code

  • Preview. Generate loads the preset without saving it, through the MilkDrop panel's own selection path (layer stack, history, every window). For an unsaved preset:
    • rating, favorite and tags stay off;
    • ◀ skips it;
    • Next continues from the top of the list.
  • Save. Save to Library saves the generator's last result, not the screen: auto-advance may have moved on.
  • Id. md_gen1_<code>, so saving twice leaves one file.
  • Code. energy-warmth-density-motion-seed brings a preset back.
    • Spaces, capitals and leading zeros read as the same code.
    • An axis above 100 makes the code invalid instead of clamping it.
  • Sliders. A slider keeps the seed. Every part draws from its own random stream, so warmth changes only colours and density adds elements without re-rolling the palette.
  • Platforms. The same code gives the same file on every platform. Only arithmetic and rounding reach the written numbers, and 7 golden hashes pin it.

Safety

  • Invert, solarize, brighten and darken stay off.
  • No above, below, if or rand.
  • Colours and alphas stay in [0, 1] at any volume. MilkDrop wraps an overflowing colour rather than clamping it, so an overflow would flicker with the beat.

Measured

Scripts outside the repo, the engine in Electron, flash limiter and reduced motion off.

  • Render probe. 200 presets (every 0/100 corner twice and 168 random points) × silence, demo and loud bass, 5 s at 320×180.
    • No shader fell back to the fixed pipeline, and all 200 were clean in all three runs.
    • At least 4% of the screen lit in silence and 9% with sound.
    • At most 33% near white.
    • At most 2 flashes/s in any sixteenth of the screen (2 of 600 runs).
    • At least 4.7% of pixels visibly changing within a second.
  • 960×720. 40 presets, all clean.
  • Originality. Of 73,405 fragments longer than 30 characters in 2,000 presets, none appears in the 10,332-preset corpus.
  • Isolated copy. Generate → the visualizer window drew it; slider kept the seed; typed code worked; saving twice left one file; favorite worked after saving; English UI has no Turkish.

The probe found four defects, and the generator changed for each:

  • Near-black sparse presets. A sparse preset now always gets a custom wave, and the left-vs-right wave modes are used only with at least two elements.
  • White-out at decay 0.99. Decay now tops out at 0.98, and the main wave's alpha follows it.
  • Rotating rings frozen in silence. They now wobble.
  • Edge-sharpening shader flashing 3/s. Its gains are lower.

Tests

37 new tests: 24 for the generator and 13 for the panel with a fake DOM. The i18n coverage test also scans the new panel. 26 of 26 mutations are caught. npm test passes 2147/2147; smoke passes, and the user-data checksums were unchanged.

Not done: mash-ups (next PR), and MIDI/OSC or web-remote actions that generate.

Refs #579

Four axes (energy, warmth, density, motion) and a seed write an original
.milk: six motion patterns, six wave patterns, four shape patterns, four
composite and two warp shaders, all written in this repository, in
MilkDrop 2's file format.

- A code (energy-warmth-density-motion-seed) brings a preset back; the id
  comes from it, so saving the same preset twice leaves one file.
- Each part draws from its own random stream, so a slider changes the
  preset rather than replacing it.
- Only arithmetic reaches the written numbers: the same code gives the
  same file on every platform. Golden hashes pin it.
- Nothing flashes: no invert/solarize/brighten, no step functions,
  colours built to stay in [0,1] at any volume (MilkDrop wraps them).

Measured on 200 presets x silence, demo and loud bass: no shader fell back,
none went black, white, frozen or flashed more than twice a second.

Refs #579
Studio gets a card with the four sliders, a code field, Generate, Shuffle
and Save to Library.

- Generate loads the preset without saving it, through the MilkDrop
  panel's own selection path. Rating, favorite and tags stay off for the
  unsaved id and back navigation skips it.
- Save writes the generator's last result, not the screen, and the
  MilkDrop panel takes it into its list at once.
- A slider regenerates with the same seed when released, not while
  dragging.
- Every new string has an English entry.

Refs #579
The 200-preset and 960x720 probes ran again on the committed generator:
the 320x180 figures are unchanged; a frame took 3.0-3.4 ms and one
960x720 run of 120 reached two flashes a second. The saved author, like
the name, is in the interface's language.

Refs #579
@CaYatur
CaYatur merged commit 69212cd into main Sep 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant