I want to add a global path which I can use in the code to provide something like a relative rather than absolute sample path. So I can prepare on one computer and copy to another without having to re-write all the sample paths in each buffer.
Currently I’ve put this into .sonic-pi/init.rb (on Windows)
# Sonic Pi init file # Code in here will be evaluated on launch. $mymusicpath = "C:/Users/guy/Music/Sonic Pi/"
Then I can put in the code e.g.
d = $mymusicpath + "foo/samples/" sample d, "bar.ogg"
Works, but is there a standard sonic-pi-y way to do it?