Hi there,
it’s important to point out that Sonic Pi’s rings are immutable. This means that you can’t change them in any way - which makes them safe to share across threads and live loops
You can read about the various operations you can perform on rings here: http://sonic-pi.net/tutorial.html#section-8-5 Note that you should always use a new variable to capture the new ring, as the original ring is never changed:
a = (ring 1, 2, 3)
b = a.reverse
# a is not changed!
However, as @mrbombmusic points out, you can use normal arrays which aren’t immutable (and are therefore not sensible to share across threads) and then convert them to a ring with .ring
to give you the ring abilities.
Also, rings do support push:
a = (ring 1, 2, 3)
b = a.push 4
puts b #=> (ring 1, 2, 3, 4)
puts a #=> (ring 1, 2, 3)
Note that you have to assign the result of push to a new variable as this does not modify a
, but produces a whole new ring
Happy to answer any further questions you might have.