back

by samaaron·6d ago·view on hn ↗
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).

1 comments
Hi Sam, big fan of you and your work!

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?

What do you mean by “running out of scratch space?”

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

I think I was not using sonipic buffers correctly (I guess they are called "tabs" in the UI). I've been using them without saving the files. I have struggled to think of it as an "editor" only because of things I'm used to with emacs: git+magit, elisp, customizable hotkeys, etc.

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!