r/musicprogramming • u/Recent-Enthusiasm626 • 23d ago
Manual algorithmic music (you supply the algorithm)
I may not be in right place here but... I've been working for some years on a Python system for writing *manual* algorithmic music. By that I mean that it's a library that provides a notation (not regular musical notation) that lets me think up algorithms and then hear what they sound like, via the MIDI files it generates as output. I first wrote it to make music based on the prime numbers and other mathematical structures, then developed it further for composing minimalist style music using operations like inversion, reflection and repetition of phrases.
It's not at all like AI-based systems that analyse other music to learn and then compose themselves automatically: it's a toolkit for playing with ideas for tunes that are too complex for a human to play. Is anyone else working in this direction?
4
u/drschlange 23d ago
Not sure if I'm off topic in what you're looking for, but I'm working on something somehow similar in the idea in Python.
It's more oriented originally as a meta-synth approach which lets you defined your own bricks you can interconnect to either route signals (not only MIDI, it considers a stream of floats basically) and produce MIDI events/notes at the end on a physical synth, or to create/craft signals which can be used as a base for generating note sequences.
The whole system is built around the idea of asynchroneous actors using threads communicating by message send. Each small module/brick can be coded/debugged/swapped at run time. As the system supports feedback loops, and with the variations of the OS scheduling, messages which are sent between the actors interleaves and always introduce surprises in what's generated when the system auto-sustains itself.
I'm also using those signals not only to create notes, but also timbres. The signals can be streamed to the wavetables of a digital synth I'm building and played in real time (even while they are rewritten)
It's not exactly meant to compose, more to "plant a seed and see what happens" (it's my personal small psychedelic machine), but the idea is to play with physical/mathematical ideas, sensors, etc, to produce sequences of notes/timbre or control.
Actually, what you're developing could integrate as a module in the system now that I think about it. I would be interested to see your project if you're willing to share.
3
u/unsolved-problems 23d ago edited 23d ago
I wrote and to some degree still write a lot of algorithmic music, and yes it's an entirely, completely different direction than generating music with GenAI, LLM, ChatGPT etc. Especially if you hand-write your own script that generates the composition. If you don't want to use a computer you can write algorithms and create compositions on paper too (i.e. by manually running the algorithm on paper), arguably this is what famous composers like Cage, or Xenakis did.
As someone who worked in this area for some time, my humble opinion is that this approach still has incredibly poor tooling. I wouldn't recommend any generic tool to anyone. I think the only practical way to achieve this to write music exactly as it sounds in your head is to do everything yourself by using programmatic environments. I don't have any recommendations, but I think your best bet is a programming language like Alda: https://github.com/alda-lang/alda (at least, "alda + my own Python scripts" is what I ended up using after trying all the other tools I could find). My basic workflow: write a script that formalizes how the music sounds in my head, generate Alda code, generate MIDI with alda, import into DAW for prototype with synths, import into MuseScore, prepare the sheet music, and give it to musicians to play. For Python you can use `music21` library. Again, this is not a recommendation, since this is likely a very fringe way to write music, this is just what works for me. This sub probably has many better general-purpose recommendations.
And yes, this requires being very comfortable with programming and music theory. In this approach you're essentially formalizing a tiny subset of music theory in a programming language. So if you're not comfortable writing the code, or expressing the mathematical relationships between notes, it gets hard. My starting point is always something trivial and from nature: like if you want music to sound like a Geiger counter, you need to model notes randomly going off following Poisson Distribution etc.
2
u/suhcoR 23d ago
Sounds like Common Music (https://commonmusic.sourceforge.net/), musx (https://github.com/musx-admin/musx) or Nyquist (https://www.cs.cmu.edu/~music/nyquist/). I'm also implementing my own algorithmic music programming language for some years based on Oberon, which can do similar things, but statically typed.
1
u/Appropriate-Lab-9226 22d ago
I used to make algorithmic music systems in MaxMSP/Pure Data. I made a plugin a long time ago to integrate into Wwise. I have a playlist here that you might find interesting from some of the various algorithmic and procedural systems I built: https://www.youtube.com/playlist?list=PLHgUhFXuZyiTzo682OWBZNBIRXYEh6ETC
1
u/eccccccc 22d ago
Yes, I’ve spent a lot of time exploring this. Sounds like we have a similar starting point - a triple: note velocity time-interval, but my instinct is to think on the phrase level instead of the note level, with a notes list, a velocities list, etc. lots of experiments and pieces came out of this, as well as my dissertation, all done by hand in supercollider. Recently resurrected it with the help of Claude as a browser app - bloom.ecc.xyz