[Csnd] Global k-rate arrays
Date | 2014-05-17 11:35 |
From | mesca |
Subject | [Csnd] Global k-rate arrays |
Hi, I am still discovering csound, so please bear with me if my question is stupid ;) In the following example, I try to update the frequency of a simple sine instrument while the note is still playing. It works as expected if I use a global k-rate variable (sine1), but if I use an array value instead (sine2), well... it doesn't. What am I missing? Thanks for your help! -- View this message in context: http://csound.1045644.n5.nabble.com/Global-k-rate-arrays-tp5735328.html Sent from the Csound - General mailing list archive at Nabble.com. |
Date | 2014-05-17 11:57 |
From | Victor Lazzarini |
Subject | Re: [Csnd] Global k-rate arrays |
You did not show your example? ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 17 May 2014, at 11:35, mesca |
Date | 2014-05-17 12:02 |
From | Pierre Clisson |
Subject | Re: [Csnd] Global k-rate arrays |
Oops, I wrote the message from the Nabble website, and it seems it didn't like the rich text tags... Here it is again: |
Date | 2014-05-17 14:26 |
From | Victor Lazzarini |
Subject | Re: [Csnd] Global k-rate arrays |
The line gkFreqArr[0] init p4 translates into #k0 init.k p4 gkFreqArr array_set.k #k0 0 and the second statement runs at k-time setting gkFreqArr[0] to #k0 (p4) all the time, so that is why the frequency never changes. It’s a bug, we’ll need to look into it. ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 17 May 2014, at 12:02, Pierre Clisson |
Date | 2014-05-17 14:44 |
From | Pierre Clisson |
Subject | Re: [Csnd] Global k-rate arrays |
Thanks. Is there a way to follow the resolution of this bug? I can't see anything at https://github.com/csound/csound/issues?labels=bug&page=1&state=open Le 17 mai 2014 à 15:26, Victor Lazzarini |
Date | 2014-05-17 16:35 |
From | Victor Lazzarini |
Subject | Re: [Csnd] Global k-rate arrays |
No, we’ve just discovered it. You could open an issue, if it’s alright. ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 17 May 2014, at 14:44, Pierre Clisson |
Date | 2014-05-17 16:52 |
From | Victor Lazzarini |
Subject | Re: [Csnd] Global k-rate arrays |
By the way, try using fillarray instead of init kFreqArray fillarray p4 because that will run at init-time only and will do what you want. ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 17 May 2014, at 16:35, Victor Lazzarini |
Date | 2014-05-17 18:40 |
From | mesca |
Subject | [Csnd] Re: Global k-rate arrays |
> By the way, try using fillarray instead of init > > kFreqArray fillarray p4 > > because that will run at init-time only and will do what you want. Yes, that works... until you need to work with multidimensional arrays. In real life, I need to do something like this: gkTracks[][] init 16, 2 ; 16 tracks, 2 properties per track: amplitude and frequency instr 1001 iti TrackIndex p1 ; a UDO to get the track index for the current instrument gkTracks[iti] fillarray p4, p5 a1 poscil gkTracks[iti][0], gkTracks[iti][1], giSine a2 linen a1, .1, p3, .1 out a2 endin i 1000.1 0 2 .5 220 i "update" 1 1 .1 440 And obviously, the line "gkTracks[iti] fillarray p4, p5" breaks the parsing. > > No, we’ve just discovered it. You could open an issue, if it’s alright. Done. View this message in context: Re: Global k-rate arrays Sent from the Csound - General mailing list archive at Nabble.com. |
Date | 2014-05-17 19:48 |
From | Victor Lazzarini |
Subject | Re: [Csnd] Re: Global k-rate arrays |
you can also use this until init is fixed. k1 init 0 if k1 == 0 then karr[0] = p4 k1 = 1 endif ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 17 May 2014, at 18:40, mesca |
Date | 2014-05-17 19:59 |
From | Pierre Clisson |
Subject | Re: [Csnd] Re: Global k-rate arrays |
Ok. Thanks for the workaround. I have thought of this before, but since it is not particularly elegant, I was wondering if another solution was possible. Anyway, I will use this until a bugfix is available. Thanks for your help! > > you can also use this until init is fixed. > > k1 init 0 > > if k1 == 0 then > karr[0] = p4 > k1 = 1 > endif |