Csound Csound-dev Csound-tekno Search About

Audio arrays instead of zaw, zawm, zar

Date2016-03-31 12:24
From"vallste@libero.it" <00000008a49663bc-dmarc-request@LISTSERV.HEANET.IE>
SubjectAudio arrays instead of zaw, zawm, zar
Hello list,
I'm starting to look into arrays (audio) to see how I can use them instead of zak opcodes for patching different instruments, I've the following doubts:

1) can I use a k variable as index to write/read in the array like:
kindex = 10
aout = a_array[kindex]
kindex = kindex + 1
a_array[kindex] = aout

2) are audio arrays zeroed at every k pass or values are persistent through k cycles? With zak opcodes zakcl must be used at each k cycle if we don't want to have the value present at the next k cycle, I must do something like a_array[kindex] = 0 at every kpass?

3) I suppose that writing at an array location completely replace the existing value with the new one so if I'd like to write the equivalent code of zawm I should do something like:
a_array[0]  = aval + a_array[0]
can someone confirm?

Thank you in advance for your help

Stefano
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-03-31 16:13
FromRory Walsh
SubjectRe: Audio arrays instead of zaw, zawm, zar
I guess 1 should work if you ksmps=1, but I ain't sure. It seems a little odd to me to want to do this in the first place. Why not just use an a-rate variable? 2, so long as you don't overwrite the index then I believe the value will persist through k-cycles. Not sure about 3, but instead of using array, why not simply use audio channels? I patch signal between instruments all the time using a-rate chnsets and chngets. Would they not be simple then using global arrays? 

On 31 March 2016 at 12:24, vallste@libero.it <00000008a49663bc-dmarc-request@listserv.heanet.ie> wrote:
Hello list,
I'm starting to look into arrays (audio) to see how I can use them instead of zak opcodes for patching different instruments, I've the following doubts:

1) can I use a k variable as index to write/read in the array like:
kindex = 10
aout = a_array[kindex]
kindex = kindex + 1
a_array[kindex] = aout

2) are audio arrays zeroed at every k pass or values are persistent through k cycles? With zak opcodes zakcl must be used at each k cycle if we don't want to have the value present at the next k cycle, I must do something like a_array[kindex] = 0 at every kpass?

3) I suppose that writing at an array location completely replace the existing value with the new one so if I'd like to write the equivalent code of zawm I should do something like:
a_array[0]  = aval + a_array[0]
can someone confirm?

Thank you in advance for your help

Stefano
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here