Help with undefined method 'call' for nil error

Runtime Error: [buffer 9, line 40] - Thread death ±-> :live_loop_arpeggi
undefined method `call’ for nil (NoMethodError) if truthy?(condition)

receiving this error when running code (linked below) in the loop buffer. it was working before but now seems to return this error regarding the live_loop: arpeggi

(the loop in question - line 40 is line beginning with voice =)

live_loop :arpeggi, sync: :drums do
melody = arpeggi_patterns.tick(:one)
beat_count.times do
voice = melody.tick(:two); key.each {|notes| on voice[tick(:three)%key.size] {visualize(notes, :chipbass)}}
binary_conv(voice, key.size)
sleep 0.5

original code for weird fishes loops and data can be found at: GitHub - mkstp/covers at 12e566d24e0844d226ac3f58f8cc22a57801e464

there is a corresponding youtube video which I have also been studying to try and figure out what I am doing differently…

any advice greatly appreciated! thank you

Spent some time playing with this tonight, and eventually got it going.
It seems that on didn’t like the condition voice[tick(:three)%key.size]
Eventually I found that it worked if you enclosed it in brackets, giving the line

voice = melody.tick(:two); key.each {|notes| on (voice[tick(:three)%key.size]) {visualize(notes, :chipbass)}}

That got things going. A very cool project.

I guess the reason may be that the Ruby version in SP has probably altered since you wrote this about 6 years ago, and that may be what is causing it to hiccup. Of course using so much fairly esoteric Ruby in your code, can always be a bit dangerous, as Sonic Pi does not always play ball with it.

1 Like

awesome! you are a superstar! cant wait to play around with this again tonight :))) thanks sm

On your hidden message, I think the bpm setting was commented out on github, If you reinstate it it sounds pretty like the original. Some synths (can;t remember if :chipbass was one or not )did get a bit louder and distorted at one Sonic Pi upgrade (again can’t remember which), but if this is the case you can wrap a with_fx :level,amp: 0.5 do......end around the arpeggi live loop which will sort this.

Hope your demo goes well.