@M_Rollers: if you want your code to be optimal and without repetition, I really think that you should aim at writing every instruction only once. I still think that wrapping parameters inside a function is not always a good idea because it makes you jump in your code too often. I do prefer using a dense writing style that helps me moving fast when I improvise.
Here is an example. You posted the following code:
live_loop :db1 do
dbk2
sleep 0.5
dbchat
sleep 0.5
dbk2
#dbclp
sleep 0.5
dbchat
sleep 0.5
end
Here is how I would have written it:
live_loop :db1 do ; tick ; use_bpm 120
midi (ring dkb2, dbchat, dbk2, dbchat).look, release: 1, channel: 1
sleep (ring 0.5).look
end
I think that this gives you the opportunity of making changes really fast. For instance, I only have to add a comma and another number to create rhythmic variation. I just have to write something like [0.5, 1].choose
to play with the release time, etc…