I’m running 4.3.0 on Windows, and ran into a really odd issue with shuffle. For some reason, shuffle just returns the original, unshuffled list or ring when that list is a scale, or was copied from one.
Scale lists do seem to contain odd syntax, in that at the start they have the whole “SonicPi::Scale :root :name” section when inspected, which is not an addressable element, so I’m wondering if that’s why?
I should mention I’m a fairly new user to Sonic Pi, so it’s possible I’m missing something here - if so, please let me know. But I thought it worth posting here to confirm.
Here’s a short test which shows this in action - no audio, just using puts to print values to log:
#test case for scale shuffle behavior
#Same action is being performed on testscale, testlist and testring
#testlist and testring become shuffled
#testscale does not
#Note, it makes no difference whether the shuffle is
#performed as result=shuffle(list), or result=list.shuffle.
testscale = scale :c3, :major
testlist = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
testring = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
testring = testring.ring
live_loop :shuffletest do
testscale = shuffle (testscale)
puts "testscale after shuffle: "
puts testscale
testlist = shuffle (testlist)
puts "testlist after shuffle: "
puts testlist
testring = shuffle (testring)
puts "testring after shuffle: "
puts testring
sleep 1
end