Not Enough Lines

Hi, im a novice in programming just beginning to learn my way through sonic pi and basic computer science in general. My trouble is that a project im working on doesn’t have enough space for it to all play in one go. Could someone give me an in depth guide to play a long song all the way through?

Simplest solution is ro take your (too long) Sonic Pi program and save it as a text file (or you can use .rb as the suffix).
Then run it in a Sonic Pi buffer using the command:

run_file "path/to/your/file.rb"

One easy way to set this up is to open a view of the folder where the file is saved, and to drag its icon into the sonic-pi buffer. This will automatically set up the path to the file inside " and you just have to put in the run_file preceding it.

Other techniques use the fact that you can have programs running simultaneously in different buffers. If you have several function definitions for example, you can put them into a buffer and run them (you wont here anything but the definitions will be set up) and then running the program which uses these functions in a second buffer. Similarly you can have live loops split between two buffers (some in each), which will work if they are synced to one live loop which will ensure that they start together. I notice you say you are a new prorammer, so start of with the first method.

1 Like