Hey, i could swear i had something like (ring 6.,8.)times do working, but i forgot how to do that.
my guess doesnt work and i cant figure out the solution.
please help me thanks
marc
Maybe with length no ?
(ring :c,:d).length.times do
puts "hello"
end
2 Likes
Or maybe you are thinking of each
?
(ring :c, :d).each do |n|
play n
sleep 1
end
1 Like
Indeed this is more logical than my pretty silly suggestion
Good morning, thanks for your suggestion, but i dont know how to implement it so i have the same result.
samps2 = "C:/Users/Gott/Desktop/scales1"
live_loop :pro1, sync: :metro do
use_random_seed get(:randseeed)
8.times do
sample samps2, "cmin", onset: choose, amp: 1 if (spread 8,8).choose
sleep 0.25
end
end
@holz: is your example above something that doesn’t do what you want it to do?
(It’s not quite clear what you’re trying to achieve)
oh well i thought its clear sorry.
the above is working fine i wanted to change that
samps2 = "C:/Users/Gott/Desktop/scales1"
live_loop :pro1, sync: :metro do
use_random_seed get(:randseeed)
#(to change the amount of times each round)#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(ring 6.,8.)times do
sample samps2, "cmin", onset: choose, amp: 1 if (spread 8,8).choose
sleep 0.25
end
end
Your second example here almost works. I made a few changes to get it working on my system:
- Changing the sample path to something that works on my system
- Removed the
sync:
since I didn’t need it for this small test - Changing the
get
to a number (so that it doesn’t end up as nil because of the missing variable only defined on your system) - Changing the
6.
and8.
to either6
and8
or6.0
and8.0
so that Sonic Pi doesn’t end up getting confused over a syntax error - Added
.tick(:t)
to the ‘repetitions ring’ so that it was stepped through every cycle around the live_loop. (This might have been the missing piece of the puzzle for you?) - changed
"cmin"
topick
so that the sample pack filter would find something to play (since there would be no samples matching"cmin"
on my computer) - added a
puts test
outside thetimes
block just to make it obvious that the varying amount of repetition worked
Here’s the result:
samps2 = "~/repos/sonic-pi/main/etc/samples"
live_loop :pro1 do
use_random_seed 0
#(to change the amount of times each round)#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(ring 6.0,8.0).tick(:t).times do
sample samps2, pick, onset: choose, amp: 1 if (spread 8,8).choose
sleep 0.25
end
puts "test"
end
1 Like
thanks ethan!
i really appreciate it. its kinda frustating if you know u had it before xD
2 Likes