[Csnd] Do until
Date | 2012-04-19 09:19 |
From | Tarmo Johannes |
Subject | [Csnd] Do until |
Hello, Greetings, |
Date | 2012-04-19 09:29 |
From | Steven Yi |
Subject | Re: [Csnd] Do until |
Hi Tarmo, It is used like: until (kval >= kmax) do Cheers! On Apr 19, 2012 9:19 AM, "Tarmo Johannes" <tarmo.johannes@otsakool.edu.ee> wrote:
|
Date | 2012-04-19 10:13 |
From | Tarmo Johannes |
Subject | Re: [Csnd] Do until |
Thank you! until (kindex<ilimit) do since there is only one instance of jspline in the memory and all values of the tval array will be the same? I imagine it is most logical to create another inwtrument that calculates the jspline and it will be started N times from a loop. But could there be also a way to call N instances of an opcode within a loop? I imagine it would be faster and less memory consuming than calling another instrument? And less lines in the code... Do I get it right? Tarmo On 19.04.2012 11:29, "Steven Yi" <stevenyi@gmail.com> wrote:
|
Date | 2012-04-19 10:59 |
From | Steven Yi |
Subject | Re: [Csnd] Do until |
Hi Tarmo, You are correct that calling the same opcode in a loop won't work. For that kind of thing, you should use a recursive UDO. There's an example of it in an article I wrote for the Csound Journal: http://www.csounds.com/journal/2006summer/controlFlow_part2.html There's a technical explanation closer to the bottom that explains the reasoning. Another example of a recursive UDO is this mode2 UDO I've been working on: opcode mode2,a,akkkkko ain, kfreq, kfreqmultiplier, kq, kampmultiplier, kqmultiplier, icounter xin ;kcurrentfreq = kfreq * (icounter + 1) itie tival aout mode ain, kfreq, kq, itie ;printk 1, kcurrentfreq if (icounter < 128) then kfreqnext = kfreq + (kfreq * kfreqmultiplier) if (kfreqnext < (sr * .3) && icounter < 128) then aout2 mode2 ain * kampmultiplier, kfreqnext, kfreqmultiplier, kq * kqmultiplier, kampmultiplier, kqmultiplier, icounter + 1 aout sum aout, aout2 endif endif xout aout endop This creates a bank of mode filters. You could create something like this and call it jspline_bank or something like that, and recurse to get n-number of instances of jspline. Also, be careful to have some condition that will terminate the recursion. Hope that helps! steven On Thu, Apr 19, 2012 at 5:13 AM, Tarmo Johannes |