Maximum characters limit per buffer?

Yes, this is a known limitation of the ( UDP) method Sonic Pi uses to communicate between the displayed buffers in the GUI and the ruby server.
There are various solutions.
First, you can split the code between more that one buffer. (It is possible to run more than one buffer at a time. ALL code is only stopped when you press the stop button.
Secondly, (and I use this technique a great deal with my code, most of which is for long linear pieces) you can use the run_file command. So of you save your code in a file MyLongPiece.rb in a folder pieces on your Pi home directory, you can run it using
run_file "/home/pi/pieces/MyLongPiece.rb"
typed into an empty buffer on Sonic Pi
and it will work when you run that, even though it is too long to run in a buffer. You will also find that the max size of the buffer is different on different platforms. I find it is smaller when running on a Mac than on a Raspberry Pi.
You can also use the run_file command from the sonic-pi-cli gem which you can install

Hope this helps.

5 Likes