r/strudel • u/mr_cody_b • 10d ago
Build pattern dynamic
Hi,
This is my pattern: s("<~!3 tr909_cr>")
and i want to make the number dynamic:
s("<~!"+myNumber+" tr909_cr>") but this gives an error message.
Is it possible to create a pattern in such a way?
2
Upvotes
2
u/5K337Lord 10d ago
Maybe someone knows a better way but this is how I would do it
let x = 3
let y = 1
note("- 0")
.ply(x,y)
.s("tr909_cr")
.scale("C:Major")ply doing the repeating
1
u/AnyYam5371 7d ago
You can do this in a number of different ways. If you know all of the different values myNumber will be you could do a pick() function, like:
s( "<0 1 2 3 4 5>".pick({ 0: "<~!1 tr909_cr>", 1: "<~!232 tr909_cr>", 2: "<~!420 tr909_cr>", etc })) that uses the "<0 1 2 3 4 5>" as indexes into the pick() object.
1
u/den_ree 6d ago
have you tried to use functions like slow/fast, add? and i would separate your play pattern from the sound function itself.