[Csnd] initialize kvalue with an array value
Date | 2014-02-05 10:21 |
From | Luis Antunes Pena |
Subject | [Csnd] initialize kvalue with an array value |
I would like to initialize a
k-variable with the first index of an array and I thought something
like this would work: karr1[] fillarray 10, 11, 13, 16, 20 imax = i(karr1[0]) kmax init imax the value of kmax is 0 instead of 10. Any ideas how to do this? Thanks, Luis -- |
Date | 2014-02-05 10:46 |
From | Tarmo Johannes |
Subject | Re: [Csnd] initialize kvalue with an array value |
Hi,
I have needed the same, but it is not possible for now. See ticket https://sourceforge.net/p/csound/tickets/90/
But can't you use iarray instead?
iarr1[] fillarray 10, 11, 13, 16, 20
tarmo
On Wednesday 05 February 2014 11:21:43 Luis Antunes Pena wrote: I would like to initialize a k-variable with the first index of an array and I thought something like this would work: |
Date | 2014-02-05 11:10 |
From | Luis Antunes Pena |
Subject | Re: [Csnd] initialize kvalue with an array value |
Hi Tarmo. Indeed with iarray it works
fine! Thanks.
Am 05.02.14 11:46, schrieb Tarmo Johannes:
|
Date | 2014-02-05 12:14 |
From | jpff |
Subject | Re: [Csnd] initialize kvalue with an array value |
Looking at the code I am a little surprised that the original code does not work. It seems to me that fillarray runs at i-time only, so karray[0] should be 10 at i-time. I will take this discussion to the developer list in order to see what can/shoud be done. ==John ff |
Date | 2014-02-05 12:37 |
From | jpff |
Subject | Re: [Csnd] initialize kvalue with an array value |
following up yes it is the parser fillarray.k args: karr1 10 11 13 16 20 ##array_get.k0 args: #k0 karr1 0 i.k args: #i0 #k0 =.i args: imax #i0 init.k args: kmax imax so the ##array_get.k0 is only called at ik-rate. Oddly karr init 10 imax = i(karr) kmax init imax works. Difficult semantics to explain! ==John ff |
Date | 2014-02-06 23:49 |
From | Luis Antunes Pena |
Subject | Re: [Csnd] initialize kvalue with an array value |
This means that karr is not allowed to
be an array, correct?
Am 05.02.14 13:37, schrieb jpff: following up yes it is the parser |