[Csnd] chnset setting an i-rate value sometime in k-time

Hey hey,
how can I properly chnset an i-rate value at control time? Consider this snippet:
if (kValue >1) then
   chnset(0.83, "MyChannel")
endif

This will only execute once. Temporarily I have circumvented this by:
kVal init 0.83

But this is ugly and surely not the Csound way. :slight_smile: Is there a standard solution/syntax for these situations?

Best wishes,

Jeanette

Hi Jeanette,

Haven't tested, but I think using k() would work like so:

if (kValue >1) then
   chnset(k(0.83), "MyChannel")
endif

Hope that helps!
Steven

Apr 1 2021, Steven Yi has written:

Hi Jeanette,

Haven't tested, but I think using k() would work like so:

if (kValue >1) then
  chnset(k(0.83), "MyChannel")
endif

Duh! I should have thought of that! Thanks a lot, Steven!

Best wishes,

Jeanette