I’m a newbie to sonic pi and ruby (though a seasoned programmer).
Does sonic pi support require_relative and require? Where do I put the files to make them easily loadable?
If I define a variable in a require file, is it visible in the project I’m working in?
Here’s the code I’ve been fooling around with, and I think it’ll be useful in multiple projects.
Thanks!
Beats.rb
Useful constants and functions for beat subdivisions
Hi
I too am new to Sonic Pi and Ruby, but certainly not a seasoned programmer. I can say that require does work in Sonic Pi, but cannot say if it is officially supported - require does not appear under Help/Lang. This thread is where I found out how to download and ‘install’ Ziffers, for example:
Hi
After downloading the zip I extracted it to my home directory on OSX (Users/myName/ziffers) and Sonic Pi ‘sees’ the required .rb file via ~/ziffers/ziffers.rb, but I guess using any valid full directory path would work too:
So ~ represents my user home directory. Thanks, that clears everything up.
I am loving sonic pi. Haven’t had this much fun with a new musical tool in ages.
And I really appreciate such a supportive community.