Running Sonic Pi code from Atom text editor

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.


  • 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. :slight_smile:

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. :slightly_smiling_face:



it works fine but do we have to install package or does it include in your package.

play selected code is wonderfull :slight_smile:

nlb, I’m glad that you like it! The play selected code feature was from rkh/atom-sonic I think.

And no, you don’t need euwbah/sonic-pi-autocomplete to install and run the package, but you do need the tool-bar package if you want the toolbar feature.

so for me the auto complete doen’t work.

in sonic pi editor the options in the context are proposed. By example, start, finish or slice as examples are proposed. not with your package in my installation under atom on ubuntu 18.04

live_loop  :bibi do
  sample :drum_cymbal_soft, start


Autocomplete is a work in progress, at the moment it only auto completes names of some samples, fx and synths.

Recently, I’ve been working on adding the other samples, fx and synths; and integration with sonic pi functions. I plan to update the package with this sometime soon.

I’ve yet to work on synth/sample/fx options, but I’ll have a look at it when I have time. :slight_smile:

I’ve edited the original post to say that the autocomplete is a work in progress.