Hi!
A while ago, I was looking to see if there was any way to run Sonic Pi code from the Atom text editor.
If you don’t know, Atom is an open source “hackable” text/code editor made by GitHub and many other contributors. It’s made up of mostly HTML, CSS and JavaScript/CoffeeScript, using GitHub’s Electron framework. You can install packages which can add more functionality to the editor, in the form of new UI panels, support for different programming languages, new ‘commands’, etc.
I found the packages rkh/atom-sonic and euwbah/sonic-pi-autocomplete. sonic-pi-autocomplete is a fork of atom-sonic and seemed to have lots of stuff in it, but unfortunately failed to install and load for me (it may have just been another package on my Atom install, I don’t know, other people may have better luck with that package). So I tried out atom-sonic, which installed and loaded in Atom fine, and had autcomplete for most of the fx, synths and samples, but failed to send OSC messages to the Sonic Pi server, therefore not running SPi code from atom. (I think it was sending it to the wrong port?)
So I forked rkh/atom-sonic, did a lot of googling and Duck Duck Go-ing to figure out how atom’s packages worked, worked on it and included some code from euwbah/sonic-pi-autocomplete, and I’ve started making a package.
It’s called sb-atom-sonic-pi (sb meaning SunderB, to make the package name more unique) and the source can be found at this repository: SunderB/sb-atom-sonic-pi.
Features:
- Allows you to remote control Sonic Pi from Atom, and run Sonic Pi code from Atom. Includes a command which saves the current file and tells Sonic Pi to play the file, allowing for playback of large buffers.
- Autocomplete for some synths, samples and fx.
[Edit: it’s work in progress, it only autocompletes names of some synths, samples and fx at the moment] - Integration with the tool-bar package to add buttons which run some commands to a toolbar.
- Keybindings that are similar to Sonic Pi’s keyboard shortcuts.
- Options to change the Sonic Pi server IP address and port, and the Sonic Pi GUI IP address and port.
I’ve recently converted the code from CoffeeScript to JavaScript, but I’m happy to contribute these changes to rkh/atom-sonic if wanted, and if I have time.
Please read the readme for more info.
Recently, I’ve been working more on the autocomplete and language integration (not published yet!), and I’ve wondered whether I should split this into multiple packages:
- language-sonic-pi-3 - for the Sonic Pi v3.x language integration and autocomplete
- atom-sonic-pi-interface - for the parts that remote control Sonic Pi (i.e. the stuff that communicates with the Sonic Pi server via. OSC and allows you to run Sonic Pi code from Atom)
Do you think this would be a good idea?
If you have any thoughts or feedback on this package, please comment below. I would like to credit the GitHub users: rkh and euwbah again, since this package is based on their packages. I hope this is useful to some people.