Create new ring

Hi, quick question. What is the most effective syntax for creating a new subset-ring from another.
E.g I want to create a subset consisting of the 0,2,4 element of the scale below.


Try this:

puts (scale :e3, :minor).values_at(0, 2, 4)

Brilliant! Many thanks for the advise :slight_smile:



puts (scale :e3, :minor).values_at(0, 2, 4)

# Runtime Error: [buffer 2, line 8] - NoMethodError
# Thread death!
# undefined method `values_at' for (ring <SonicPi::Scale :E :minor [52, 54, 55, 57, 59, 60, 62, 
# 64]):SonicPi::Core::RingVector

It worked fine with me.
(Sonic Pi v3.2.0 Windows 10)

live_loop :test do
   notes =  (scale :e3, :minor).values_at(0, 2, 4)
   play notes.tick
   sleep 0.5

@Martin - you perhaps should be a bit clearer that you’re running the absolute latest commits which is very much unsupported and likely to be confusing for others that are running a tagged release.

Thanks for mentioning it though - it was already on my TODO list when I wrote the original reply to this thread :wink:

1 Like

Oh, yes, sorry. I had the other thread in mind where this was mentioned twice. But obviously I did not mention this in this thread.

1 Like

I should add now that values_at should now be working again on the latest from GitHub and will be part of the upcoming beta-1

1 Like


Now here is my personal overview, how you can use rings to handle collection of notes, cutoff and other values: Manipulate a collection of notes. Might be useful for one or the other.

Stay healthy!

1 Like