Csound Csound-dev Csound-tekno Search About

[Cs-dev] Arrays not behaving as expected

Date2014-10-05 19:56
FromEdward Costello
Subject[Cs-dev] Arrays not behaving as expected
Hi, this instrument is not behaving as expected

instr KRATE_ARRAY_1D_write

    kout[] init 4

    kout[0] = 1
    kout[1] = 2
    kout[2] = 3
    kout[3] = 4

    printk2 kout[0]
    printk2 kout[1]
    printk2 kout[2]
    printk2 kout[3]


    kout[0] = kout[0] + 1
    kout[1] = kout[1] + 1
    kout[2] = kout[2] + 1
    kout[3] = kout[3] + 1
endin

I was expecting an output of each element being printed increasing by 1 each time but instead I just get this: 

 i2     1.00000
 i2     2.00000
 i2     3.00000
 i2     4.00000

Until the performance ends.
I’m definitely running it for more than 1 k cycle,
Any ideas?
Ed


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.ne

Date2014-10-05 20:04
FromVictor Lazzarini
SubjectRe: [Cs-dev] Arrays not behaving as expected
The lines kout[0] = 1 etc are setting the array to 1 etc every k-cycle.

Try this

instr KRATE_ARRAY_1D_write
kinit init 0
if kinit > 0 kgoto printout

   kout[] init 4

   kout[0] = 1
   kout[1] = 2
   kout[2] = 3
   kout[3] = 4

printout:
   kinit = 1
   printk2 kout[0]
   printk2 kout[1]
   printk2 kout[2]
   printk2 kout[3]


   kout[0] = kout[0] + 1
   kout[1] = kout[1] + 1
   kout[2] = kout[2] + 1
   kout[3] = kout[3] + 1
   
endin


========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

On 5 Oct 2014, at 19:56, Edward Costello  wrote:

> Hi, this instrument is not behaving as expected
> 
> instr KRATE_ARRAY_1D_write
> 
>    kout[] init 4
> 
>    kout[0] = 1
>    kout[1] = 2
>    kout[2] = 3
>    kout[3] = 4
> 
>    printk2 kout[0]
>    printk2 kout[1]
>    printk2 kout[2]
>    printk2 kout[3]
> 
> 
>    kout[0] = kout[0] + 1
>    kout[1] = kout[1] + 1
>    kout[2] = kout[2] + 1
>    kout[3] = kout[3] + 1
> endin
> 
> I was expecting an output of each element being printed increasing by 1 each time but instead I just get this: 
> 
> i2     1.00000
> i2     2.00000
> i2     3.00000
> i2     4.00000
> 
> Until the performance ends.
> I’m definitely running it for more than 1 k cycle,
> Any ideas?
> Ed
> 
> 
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2014-10-05 20:06
FromVictor Lazzarini
SubjectRe: [Cs-dev] Arrays not behaving as expected
or else use fillarray

http://csounds.com/manual/html/fillarray.html

========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

On 5 Oct 2014, at 19:56, Edward Costello  wrote:

> Hi, this instrument is not behaving as expected
> 
> instr KRATE_ARRAY_1D_write
> 
>    kout[] init 4
> 
>    kout[0] = 1
>    kout[1] = 2
>    kout[2] = 3
>    kout[3] = 4
> 
>    printk2 kout[0]
>    printk2 kout[1]
>    printk2 kout[2]
>    printk2 kout[3]
> 
> 
>    kout[0] = kout[0] + 1
>    kout[1] = kout[1] + 1
>    kout[2] = kout[2] + 1
>    kout[3] = kout[3] + 1
> endin
> 
> I was expecting an output of each element being printed increasing by 1 each time but instead I just get this: 
> 
> i2     1.00000
> i2     2.00000
> i2     3.00000
> i2     4.00000
> 
> Until the performance ends.
> I’m definitely running it for more than 1 k cycle,
> Any ideas?
> Ed
> 
> 
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2014-10-06 00:02
FromEdward Costello
SubjectRe: [Cs-dev] Arrays not behaving as expected
Thanks, fillarray did the trick, 

> On 5 Oct 2014, at 21:06, Victor Lazzarini  wrote:
> 
> or else use fillarray
> 
> http://csounds.com/manual/html/fillarray.html
> 
> ========================
> Dr Victor Lazzarini
> Dean of Arts, Celtic Studies and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952 
> 
> On 5 Oct 2014, at 19:56, Edward Costello  wrote:
> 
>> Hi, this instrument is not behaving as expected
>> 
>> instr KRATE_ARRAY_1D_write
>> 
>>   kout[] init 4
>> 
>>   kout[0] = 1
>>   kout[1] = 2
>>   kout[2] = 3
>>   kout[3] = 4
>> 
>>   printk2 kout[0]
>>   printk2 kout[1]
>>   printk2 kout[2]
>>   printk2 kout[3]
>> 
>> 
>>   kout[0] = kout[0] + 1
>>   kout[1] = kout[1] + 1
>>   kout[2] = kout[2] + 1
>>   kout[3] = kout[3] + 1
>> endin
>> 
>> I was expecting an output of each element being printed increasing by 1 each time but instead I just get this: 
>> 
>> i2     1.00000
>> i2     2.00000
>> i2     3.00000
>> i2     4.00000
>> 
>> Until the performance ends.
>> I’m definitely running it for more than 1 k cycle,
>> Any ideas?
>> Ed
>> 
>> 
>> ------------------------------------------------------------------------------
>> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
>> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
>> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
>> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> 
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net