Hi Alex, You are correct and you can not use a loop to do what you want. This being able to delay x number of signals isn't a straightforward thing to do in csound. When you call an opcode, you can imagine it being like an object and that you are calling something like vdelay.process(x). If you think of it this way, it means each time you call it, you are advancing its internal state by one step in the processing. Normally this is the expected behavior that you call it once per k- count, but if you call it multiple times the behavior won't be what you're expecting. For Csound, any time you want to process x number of signals (process a variable amount of signals) you'll need to use a recursive User Defined Opcode (UDO). It's the only way to setup things correctly and can be tricky if you are not experienced with recursive algorithms (I don't know your background). Your example does not vary the delay times so I can't really suggest a complete solution, but something like: opcode recurseVdelay 0, kii kdelay, izakstart, izakend xin azak zar izakstart adelay vdelay azak, kdelay, 5000 zaw adelay, izakstart if (izakstart <= izakend) then recurseVdelay kdelay, izakstart + 1, izakend endif endop then call it in instr code like: recurseVdelay kdelay, 0, izakspace I haven't tried the above code but I think it'll work. steven p.s. - If you haven't checked them out already, I wrote two articles for the Csound Journal on control flow which describes loops and recursive UDO's: http://www.csounds.com/journal/2006spring/controlFlow.html http://www.csounds.com/journal/2006summer/controlFlow_part2.html The whole thing about loops and why you can't call most opcodes in loops is explained in part2 in discussing when to use recursion. On 9/16/07, Alex Weiss wrote: > Hi everybody > > I'm currently working on a Csound instrument, but there's something > that I just don't know how to implement: > If have a zak array that holds quite a few a-rate signals. Now, what I > basically want to do is delay each of these signals (with different > delay times) and write them back into the zak space. The following > code obviously doesn't work: > > (kr = sr) > > > kcount = 1 > > loop: > azak zar kcount > adelay vdelay azak, kdelay, 5000 > zaw adelay, kcount > kcount = kcount + 1 > if (kcount <= izakspace) kgoto loop > > > > It seems that there is no way that I can use a loop to perform the > operation (which was the reason I chose to work with zak to begin > with...). Do I really have to delay every signal manually? > > I hope somebody can help me out here... Thank you in advance. > > Alex > > -- > Send bugs reports to this list. > To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk >