Hacker News new | past | comments | ask | show | jobs | submit
I love Sonic Pi. I am a terrible musician but I really enjoy finding chords for a song and then putting them into a sonic pi buffer and messing around. U2 started as a cover band, right, so maybe this is a path to becoming musical someday.

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.

If you look in the source code you’ll find an example REPL which serves as a great minimal example of how you can build your own interface.

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).

loading story #49248071
You can save/load the contents of a single buffer or all buffers. For a single buffer, select the buffer you want to save, then go to the Live menu and choose "Save Buffer As". To load a file into a buffer, choose the buffer you want to load it into and then go to the Live menu and select "Load into Buffer"

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 ;) )

loading story #49254226