Csound Csound-dev Csound-tekno Search About

[Cs-dev] [Csnd] initialize kvalue with an array value (fwd)

Date2014-02-05 12:17
Fromjpff
Subject[Cs-dev] [Csnd] initialize kvalue with an array value (fwd)
AttachmentsNone  None  
I cannot see why this does not work.  fillarray only runs at i-time so 
karr1-o] should have a value of 10 in the i-rate assignment, unless the 
parser is promotig this to k-rate in a mistaken belief the the existene f 
karr1 forces k-rate.  Can anyone disillusion me?
==John ff

---------- Forwarded message ----------
Date: Wed, 05 Feb 2014 11:21:43 +0100
From: Luis Antunes Pena 
Reply-To: csound@lists.bath.ac.uk
To: csoundlist 
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

--
http://luisantunespena.eu


Date2014-02-06 14:20
FromSteven Yi
SubjectRe: [Cs-dev] [Csnd] initialize kvalue with an array value (fwd)
There is a bug already filed by Tarmo that is related to this:

https://sourceforge.net/p/csound/tickets/90/

The explanation for why this happens is here:

http://csound.1045644.n5.nabble.com/csound6-getting-i-value-of-a-kArray-member-td5729623.html

It's the karr1[0] that returns 0 during init-time because it is not
run at init-time. The temporary variable that karr1[0] is written out
to is initialized to 0 at init time, then the access to karr1 which is
done with an arrayget opcode actually runs at performance time.

steven

On Wed, Feb 5, 2014 at 7:17 AM, jpff  wrote:
> I cannot see why this does not work.  fillarray only runs at i-time so
> karr1-o] should have a value of 10 in the i-rate assignment, unless the
> parser is promotig this to k-rate in a mistaken belief the the existene f
> karr1 forces k-rate.  Can anyone disillusion me?
> ==John ff
>
>
> ---------- Forwarded message ----------
> Date: Wed, 05 Feb 2014 11:21:43 +0100
> From: Luis Antunes Pena 
> Reply-To: csound@lists.bath.ac.uk
> To: csoundlist 
> 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
>
> --
> http://luisantunespena.eu
>
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net