by xrd · 3mo ago · 0 comments
The one thing that confuses me about Sonic Pi is the buffers/editor. I always wish I could replace the UI with my own embedded editor (emacs in my case). I would then be able to manage all my songs as files. Right now I hunt for "least crowded" buffer window, comment out the code for the song or songs, and then add my new song. If I had my own embedded editor (like emacs), I could rename buffers to be songs, have an unlimited amount (rather than just ten), integrated version control, etc.
Am I missing something simple about how others use sonic pi?
The big breakthrough of sonic pi is representing music as a highly readable text file. I assume I don't know how to use the built in editor and buffer system because I feel a lot of friction there.
You essentially need to spawn a process, read the session’s port numbers and then send messages via OSC over the local network loopback.
This could easily done from your favourite editor of choice (e.g. Emacs).
Does this mean I just don't understand how to use the existing UI? I'm often messing around with a bunch of chords and sounds and I quickly run out of scratch space. Does that mean I'm doing it wrong?
Do you mean your code was too long that Sonic Pi refused to run it? If so this has been addressed in v5 with much larger buffer sizes supported.
Or do you mean you ran out of buffer? In which case v5 helps again as you can now save and load all the buffers to and from a single save-file :-)
Basically, I have been only using the tabs as a location for experiments (not something that can be persisted as a file and loaded/unloaded), and when I run out of empty ones, I was simply commenting out the old experiment, and adding new ones. It is not ideal, but comes from my own mental limitations.
My problems are not unique to Sonic Pi: as I use AI more for experimentation, I'm struggling with how I pipe AI output to an editor, whether that from CLI tools like agy or opencode, or terminal editors like emacs. Nothing feels right, yet. For example, I have been using agy to generate sonicpi code, but then I copy and paste it. I laugh at the joke used to be stackoverflow -> copy buffer, now it is AI agent -> copy buffer.
But, is there a better way to do it than using agy with a prompt, then copying that into a tab in Sonic Pi? Copying into a bunch of different text fields is my new reality, and I don't love it.
Sonic-Pi should probably come with a warning that is isn't a good tool for dinosaurs like myself! But, it actually IS a great tool for dinosaurs, it just won't fix the tiny reptilian brain of the dinosaur.
I like the new features around saving multiple buffers to a single file, and think this will help.
And, the REPL example is exciting. I'm excited to build my own UI just as a thought experiment.
Thank you again for Sonic-Pi. It is a fantastic tool!
You can also save off all the buffers together (e.g. if you've put different parts of the same song into different buffers) by going to the Live menu and choosing "Save Set As" (or just "Save Set" if you want to overwrite what was previously in your last saved set e.g. you made changes to your song and you want to replace the previous version).
So to achieve a workflow similar to what you're describing, you construct your song (in up to ten buffers) and then save the set and clear the buffers or load a different set to work on another song. True, it doesn't give you infinite buffers, but it does give you a way to "manage all [your] songs as files".
You can then use e.g. Magit to version control the files just as you would if you were working in Emacs itself.
The sets are also saved as text files in a very human readable format; basically just all of the buffers dumped out one after another with some delimiters. You could even use Emacs to edit them and then load them into Sonic Pi to run them! (That said, I'm not sure there's a good sonic-pi-mode for things like indentation and autocomplete yet. Hopefully someday; I would love to have my custom evil-mode Emacs keybindings while working in Sonic Pi, but I get that it's not really a priority right now ;) )
Second, take a look a PureData. Specifically the variant called PlugData, because it is a little easier to use because of the extensions that it includes, nicer UI, and it can run as a plug-in and integrate with other your DAW, or other software.
I've been using Pd off and on for about 20 years and I still feel I don't know it. I learn just enough to get done what I need to get done. I use it for control system for drone motors that I use to make music, both using a rotary magnetic bow, and as servo drumming actuators. I've also used it for sound and rhythm synthesis for performances.
PureData is an incredible tool for creative building. I'm also using it for a project at a university lab to make an assistive guitar for disabled musicians by running compiled PureData on a Bela Gem Multi. You can even use Pd on a Daisy Seed to make custom effects pedals or synth modules. Anyhoo, check it out. It is a wonderful playground for the mind.
Consider his his older project instead? https://overtone.github.io/
He even used to perform using emacs before he created Sonic Pi.