[Csnd] A k-rate programming conundrum (variable change)
Date | 2020-05-01 18:15 |
From | "Jeanette C." |
Subject | [Csnd] A k-rate programming conundrum (variable change) |
Hey hey, I have a master instrument selectively triggering a few others. There is a global gkArray[] of control parameter which the master instrument gathers. When another instrument (sound generator) is triggered it should react to changes in this global array to modify its own parameters. I have naively realised that with changed in the sound generators, like this: if gkSoundchoice == 1 then if changed(gkParams[0] != 0 then kparam[0] = gkParams[0] ... endif ; parameter queries endif ; Sound is active for editing ... anoise opcode kparam[0], kparam[1], ... ... endin The thing is: parameters should remain as before, unless a parameter change happens while the instrument is allowed (gkSoundChoice) to accept changes. I think calling changed does not work, since at least some parameters in gkParams[] have been changed by other sound generators and so, compared to the last "edit activation" of this instrument, the state has changed. The sound generator are alwayson, so a different solution could use that fact, as long as it doesn't need much CPU. The orchestra is getting hungry. :) Can someone suggest a way? Maybe the whole construct is bound to fail anyway? Best wishes, Jeanette -- * Website: http://juliencoder.de - for summer is a state of sound * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g * SoundCloud: https://soundcloud.com/jeanette_c * Twitter: https://twitter.com/jeanette_c_s * Audiobombs: https://www.audiobombs.com/users/jeanette_c * GitHub: https://github.com/jeanette-c I'm so curious, what do you think of me <3 (Britney Spears) Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2020-05-01 18:40 |
From | joachim heintz |
Subject | Re: [Csnd] A k-rate programming conundrum (variable change) |
hi jeanette - if i get it right, this is the situation: 1. you have a global k-array 2. instruments use the values in this array but 3. you want to tell these instruments when to use a change in the global array (so they will not use the change in the moment it is done, but later). if this is correct, i'd suggest that you have a local k-array in your instrument. it is a copy of the global array when the instrument starts. it will be updated only if you allow it: if gkSoundChoice==1 then kLocalArray = gkArray endif best - joachim On 01/05/2020 19:15, Jeanette C. wrote: > Hey hey, > I have a master instrument selectively triggering a few others. There is > a global gkArray[] of control parameter which the master instrument > gathers. > > When another instrument (sound generator) is triggered it should react > to changes in this global array to modify its own parameters. > > I have naively realised that with changed in the sound generators, like > this: > if gkSoundchoice == 1 then > if changed(gkParams[0] != 0 then > kparam[0] = gkParams[0] > ... > endif ; parameter queries > endif ; Sound is active for editing > ... > anoise opcode kparam[0], kparam[1], ... > ... > endin > > The thing is: parameters should remain as before, unless a parameter > change happens while the instrument is allowed (gkSoundChoice) to accept > changes. > > I think calling changed does not work, since at least some parameters in > gkParams[] have been changed by other sound generators and so, compared > to the last "edit activation" of this instrument, the state has changed. > > The sound generator are alwayson, so a different solution could use that > fact, as long as it doesn't need much CPU. The orchestra is getting > hungry. :) > > Can someone suggest a way? Maybe the whole construct is bound to fail > anyway? > > Best wishes, > > Jeanette > Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2020-05-01 19:13 |
From | "Jeanette C." |
Subject | Re: [Csnd] A k-rate programming conundrum (variable change) |
May 1 2020, joachim heintz has written: > hi jeanette - > > if i get it right, this is the situation: > 1. you have a global k-array > 2. instruments use the values in this array but > 3. you want to tell these instruments when to use a change in the global > array (so they will not use the change in the moment it is done, but later). Not quite, the instrument will use current values, but only newly arriving values within its time slot. I'm considering to have another global instrument to always read the parameters and distribute changes based on the group of gkSoundChoice variables. That way a constantly running changed can be used... Best wishes, Jeanette > > if this is correct, i'd suggest that you have a local k-array in your > instrument. it is a copy of the global array when the instrument starts. it > will be updated only if you allow it: > > if gkSoundChoice==1 then > kLocalArray = gkArray > endif > > best - > joachim > > > > On 01/05/2020 19:15, Jeanette C. wrote: >> Hey hey, >> I have a master instrument selectively triggering a few others. There is a >> global gkArray[] of control parameter which the master instrument gathers. >> >> When another instrument (sound generator) is triggered it should react to >> changes in this global array to modify its own parameters. >> >> I have naively realised that with changed in the sound generators, like >> this: >> if gkSoundchoice == 1 then >> if changed(gkParams[0] != 0 then >> kparam[0] = gkParams[0] >> ... >> endif ; parameter queries >> endif ; Sound is active for editing >> ... >> anoise opcode kparam[0], kparam[1], ... >> ... >> endin >> >> The thing is: parameters should remain as before, unless a parameter change >> happens while the instrument is allowed (gkSoundChoice) to accept changes. >> >> I think calling changed does not work, since at least some parameters in >> gkParams[] have been changed by other sound generators and so, compared to >> the last "edit activation" of this instrument, the state has changed. >> >> The sound generator are alwayson, so a different solution could use that >> fact, as long as it doesn't need much CPU. The orchestra is getting hungry. >> :) >> >> Can someone suggest a way? Maybe the whole construct is bound to fail >> anyway? >> >> Best wishes, >> >> Jeanette >> > > Csound mailing list > Csound@listserv.heanet.ie > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND > Send bugs reports to > https://github.com/csound/csound/issues > Discussions of bugs and features can be posted here > -- * Website: http://juliencoder.de - for summer is a state of sound * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g * SoundCloud: https://soundcloud.com/jeanette_c * Twitter: https://twitter.com/jeanette_c_s * Audiobombs: https://www.audiobombs.com/users/jeanette_c * GitHub: https://github.com/jeanette-c I'm so curious, what do you think of me <3 (Britney Spears) Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2020-05-01 19:28 |
From | "Jeanette C." |
Subject | Re: [Csnd] A k-rate programming conundrum (variable change) |
Sorry: found the solution: use changed2 instead of changed. Apparently that does the tirck. Best wishes, Jeanette -- * Website: http://juliencoder.de - for summer is a state of sound * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g * SoundCloud: https://soundcloud.com/jeanette_c * Twitter: https://twitter.com/jeanette_c_s * Audiobombs: https://www.audiobombs.com/users/jeanette_c * GitHub: https://github.com/jeanette-c I'm so curious, what do you think of me <3 (Britney Spears) Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |