I’d like to propose an idea and collect some feedback (has someone tried this? is it insane?) – and maybe find collaborators. It may sound a bit off, but please hear me out.
I’d love to make a plugin that has a Python interpreter compiled into it – why and what for?
Rack is mostly about generative music for me, but with the existing plugins I find it pretty hard to experiment quickly with certain kinds of ideas, even simple ones. In a way you have to let the plugins’ capabilities guide you, rather than use the plugins to implement an idea you have. This is a lot of fun, of course, but sometimes not enough. Using tons of basic plugins as a kind of “programming language” typically ends in an insane cable mess, and it does not qualify as quick experimentation. Also, more “musical” stuff (scales, modulation, chords) is challenging with modules.
The way out, of course, is programming. But writing and compiling a dedicated C++ plugin for each “What would it sound like if…?” isn’t really a nice workflow.
Hence the idea of having a simple but expressive language like Python compiled into a plugin.
Obviously, the plugin would not do any signal processing. It would operate in the temporal resolution of a typical sequencer and create a bunch of V/Oct, CV and gate signals triggered by a clock pulse.
It could have a bunch of generic knobs or sliders (with CV inputs) whose values can be read from the Python script, much like generic hackable Eurorack hardware modules that run different algorithm (O&C, Mordax Data, …). It should have a small “display” for showing some text. More graphical output is not necessary.
It could also serve as a rapid prototyping tool for plugin devs to some limited degree, mainly for prototyping sequencer type ideas.
I’ve done generative music with Python before, using MIDI, and I know it works. I could use my MIDI stuff of course, but a plugin would be way cooler and smoother.
Building an API for musical concepts (scales, modes, chords, transposition, sequence mutation) is quite straightforward with Python. I’m happy to contribute what I’ve built in that space.
Python is (somewhat) modern, expressive and very accessible, in contrast to some other languages used in generative music. Maybe it can get some people into coding and music who would not touch C++. There are a lot of great resources for learning Python out there.
Python is known to play nicely with C++. Embedding Python in a C/C++ project is something that’s documented and has been done before.
Python has some language features which are really cool for generative music on board, such as generators, list manipulation APIs, randomness stuff. You can create powerful APIs and do things like:
sequence = [1,3,5,6,7] scale = Dorian('A') other_scale = Phrygian('D#') transposed_sequence = [other_scale[d] for d in sequence] notes_random_oct = [scale[i] + random.choice([-12, 0, 12]) for i in sequence]
- Python has a ton of great data processing, numerics and not the least machine learning libraries. If anyone is into experimenting with this stuff for creating music, that plugin would be a great entry point. (I actually experimented a bit with linear dimension reduction on classical piano scores.)
Why haven’t I just done it?
While I work with Python on a daily basis, I have not really touched C++ for at least 5 years. I’ve played with the plugin API and find it easy enough, but the whole part of compiling Python into the plugin I find really challenging as I’ve never been good with the compilers anyway. Also, my C++ is probably not up to modern standards anymore.
So, if the idea is not completely insane, I’m looking collaborators, especially those who are good with the compiler (I’m on Mac, btw). I’m happy to do the Python side and the core plugin functionality, but I need help for the deep embedding stuff. I think a have a fairly clear idea about the overall architecture, and I’m determined to keep it simple in the beginning.
(Sorry for a long post.)