Csound Csound-dev Csound-tekno Search About

[Cs-dev] zak bug?

Date2008-12-10 17:32
FromJonatan Liljedahl
Subject[Cs-dev] zak bug?
The below orchestra works fine, but if I try to use zak arrays instead
of three global audio variables (see commented out lines) I get no sound
from instr 6 when p4 is 2 and 3. Am I missing something or is this a bug?

sr = 44100
kr = 4410
nchnls = 18

0dbfs = 1

gkpw chnexport "waveshape", 1

ga1 init 0
ga2 init 0
ga3 init 0
;zakinit 4, 4

instr 5
    k1 line p4, p3, p5
    a1 vco2 p6, k1, 4, gkpw

    aenv linseg 0, 0.001, 0.7, p3*0.7, 1, p3*0.3, 0
    a1 = a1*aenv

    kpan line p7, p3, 1-p7
    al, ar pan2 a1, kpan

    if (p4 < 200) then
        kz = 1
        ga1 = ga1 + a1
    elseif (p4 < 2000) then
        kz = 2
        ga2 = ga2 + a1
    else
        kz = 3
        ga3 = ga3 + a1
    endif

    kch = 1+((kz-1)*2)
    printk2 kz
;    zawm a1, kz

    outch kch, al*0.15, kch+1, ar*0.15
endin

instr 6
    printk2 p4
;    a1 zar p4
    if (p4 == 1) then
        a1 = ga1
        ga1 = 0
    elseif (p4 == 2) then
        a1 = ga2
        ga2 = 0
    else
        a1 = ga3
        ga3 = 0
    endif

    a2 delay a1, 1

     aL streson a2*0.1, 47, 0.97
    aR streson a2*0.1, 48, 0.97

    aL clip aL*2, 0, 0.35
    aR clip aR*2, 0, 0.35

    arL, arR reverbsc aL, aR, 0.95, 2000

    kch = 7+((p4-1)*4)

    outch kch, (aL*0.5), kch+1, (aR*0.5), kch+2, (arL*0.5), kch+3, (arR*0.5)

;    zacl 0, 4
endin

-- 
/Jonatan         [ http://kymatica.com ]

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-12-10 17:56
FromAdam
SubjectRe: [Cs-dev] zak bug?
AttachmentsNone  

Date2008-12-10 17:58
FromJonatan Liljedahl
SubjectRe: [Cs-dev] zak bug?
I found out what it was (I think, haven't tried it yet): I run three
instances of instr 6 in parallel with p4 set to 1, 2 and 3 (to choose
what za variable to read from) but instr 6 clears all three za vars, it
should clear only the one itself uses (zacl p4, p4).

Note that if it *does* index from 0, a "zaw a1, 1" and "zakinit 1,1" as
in the examples, would mean it writes outside the allocated space.
(initializing room for 1 value means that the only valid index is 0)

Adam wrote:
> I haven't tried your orchestra, but from your previous question, 
> its my belief that zak references start from 0 not 1. 
> 
> See the zacl use here, 
> http://www.csounds.com/manual/html/zacl.html
> 
> You're right that its not mentioned at 
> http://www.csounds.com/manual/html/ZakTop.html
> 
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


-- 
/Jonatan         [ http://kymatica.com ]

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net