Dynamic methodsmade from a loop

Hello!
I’ve been getting deeper into Ruby thanks to Sonic Pi. I’ve been exploring the use of Hashes & keeping “lists of properties” for specific chPreformatted textannels (to be controlled by my Korg nanoKontrol2 midi input. )

I had an idea to “assign” certain “with_fx” + params to specific channels.
my problem is, I don’t know how to iterate through a list of potential FX, THEN play the sample “inside” a nested load of FX…

I had tried a repeat loop, but, the way I wrote it, means that when I set up a new “with_fx” it plays “the channel sample” each time. So, if a channel has 3 FX, it makes 3 “with_fx” containers, but plays the sample “inside” each time. (which lead to lags & FX not quite being applied as they should sound. )

My thought : can you create a “dynamic method” that can “compile” a bunch of FX, then play the sample after all the “with_fx” have been defined?

is it possible?

1 Like

Could you add three backticks between your code to make it more readable ?
Thanks and sorry no answer for your main question.

hi,
I don’t know what that is! (how do I “backTick” ? )… probably missed a “read this first”… I am a n00b , apologies. I did take a screen dump of the code & replace it above, if that helps?
cheers.

1 Like

Hi @philAwesomeTech,

that’s no problem: See here what a backtick is. Three of these in a separate line before and after your code example will nicely formate and color the code and make it thus much better readable. See also Sam’s remark about formatting (scroll down the page for the headline code blocks).