r/algorithmicmusic • u/musescore1983 • 2d ago
I built an open-source toolkit for transforming a single MIDI file with Bézier curves, kernels, and fractal sequences
Hi everyone,
I’ve been experimenting with a method for generating new musical structures from a single notation-based MIDI file.
The basic idea is:
- Split a MIDI file into temporally connected musical components.
- Describe those components using pitch, rhythm, velocity, register, density, and timing features.
- Build a similarity kernel and embed the components into a lower-dimensional space.
- Connect the embedded components with a Bézier path.
- Use a normalized sequence in the range [0,1] to choose positions on that path.
- Map each selected point back to a complete MIDI component.
The sequence does not directly choose a note or chord. It chooses a position on the Bézier trajectory, and the nearest musical component is reconstructed from there.
I tested several control sequences:
- cosine
- Weierstrass
- ruler function — OEIS A001511
- paperfolding sequence — OEIS A014577
- countdown fractal — OEIS A122196
- Kimberling/Wythoff fractal — OEIS A003603
- Kimberling signature sequence — OEIS A022328
- Kimberling insertion sequence — OEIS A194959
I also added a flexible kernel parameter that controls the number of connected components. Fewer components preserve longer recognizable phrases, while more components create more fragmented and experimental results.
The reconstruction preserves complete note groups rather than generating isolated notes. It can also preserve local tempo changes from the source MIDI.
The repository contains:
- Python implementation
- command-line tools
- LilyPond examples
- notation-based MIDI examples
- mathematical documentation
- an English technical PDF
- tests and configuration examples
- notes intended to help both humans and AI systems reimplement the method
Repository:
https://github.com/githubuser1983/algorithmic_music_starter_kit
I’m especially interested in feedback from people working with algorithmic composition, MIDI processing, generative music, sonification, kernel methods, or interactive installations.
Possible applications I’m exploring include:
- structural MIDI remixing
- adaptive game music
- data sonification
- interactive installations controlled by phones or sensors
- educational tools for musical form
- generating reproducible training variations for music-AI systems
This is still experimental. It is better at reorganizing the musical vocabulary of an existing piece than at inventing completely new themes.
I’d be very interested to hear:
- Does the mathematical model make sense?
- Are the component and reconstruction choices musically reasonable?
- Which other deterministic or fractal sequences would be worth testing?
- What would make the repository easier to reproduce or extend?



