Csound Csound-dev Csound-tekno Search About

[Csnd] initialize kvalue with an array value

Date2014-02-05 10:21
FromLuis 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

--
signatur http://luisantunespena.eu


Date2014-02-05 10:46
FromTarmo Johannes
SubjectRe: [Csnd] initialize kvalue with an array value
signatur

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
;imax = i(karr1[0])
kmax init iarr1[0]

 

 

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:

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

--

http://luisantunespena.eu




Date2014-02-05 11:10
FromLuis Antunes Pena
SubjectRe: [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:
signatur

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
;imax = i(karr1[0])
kmax init iarr1[0]

 

 

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:

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

--

http://luisantunespena.eu





--
signatur http://luisantunespena.eu

Date2014-02-05 12:14
Fromjpff
SubjectRe: [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



Date2014-02-05 12:37
Fromjpff
SubjectRe: [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

Date2014-02-06 23:49
FromLuis Antunes Pena
SubjectRe: [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

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


Send bugs reports to the Sourceforge bug trackers
csound6:
           https://sourceforge.net/p/csound/tickets/
csound5:
           https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"





--
signatur http://luisantunespena.eu