Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to use Sonic Pi Snippets

Sonic Pi has an experimental, undocumented feature to support snippets, which autoexpand with the TAB key.

Here's the issue:

Specifically, Sam's comment:

... [T]o play with it now (with the caveat that it all may drastically change) you just need to create a file with the contents of your snippet with an .sps extension in a directory somewhere on your machine. You might want to create a snippets directory for your own personal snippets. The name of the file doesn't matter. You then load all the snippets in a given directory with:


At the top of the file you'll need to put some metadata telling Sonic Pi when to trigger your snippet and where to leave the cursor.

Here's an example of a complete snippet (from here:

# key: fx r
# point_line: 1
# point_index: 2
# --
with_fx :reverb do


# key: tells Sonic Pi which letters to look for prior to point (the cursor) when tab is hit.
# point_line: tells Sonic Pi which line to place the point on (relative to the snippet). This is 0 indexed
# point_index: tells Sonic Pi which position on the line to place the po I int (also 0 indexed). This is also relative to the snippet.

Some example snippets:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment