After thinking about this more I can now simplify my question down to this: Is it possible to build a recursive UDO with a k-rate variable determining the level of recursion? Below I've presented another example. I want to simply sum a series of numbers together but I want to specify the range of numbers to be summed. opcode test, k, kp krange, icnt xin ;read input parameters if (icnt >= krange) goto skip k1 test krange, icnt+1 skip: ksum = icnt xout k1+icnt ;write output endop 2008/11/25 Rory Walsh : > Thanks Steven, I had forgotten about your article. It's not quite what > I'm looking for but now that I think of it I'm not sure what I am > doing can be done with a UDO. I need so simplify my example. I'll get > back you on it! Thank for taking a look. > > Rory. > > 2008/11/25 Steven Yi : >> Hi Rory, >> >> I'm not sure if this is exactly what you're after, but I had done this UDO: >> >> opcode yi_add_table,a,ikko >> >> itable, kenv, kpch, i_index xin >> >> itablesize = ftlen(itable) >> >> ifreq tablei i_index, itable >> iamp tablei i_index + 1, itable >> >> kfreq = kpch * ifreq >> >> if (iamp > 0) then >> asig oscil3 iamp, kfreq, gi_sine >> else >> asig = 0 >> endif >> >> kcount = 0 >> kenv_local = kenv >> >> loopStart: >> >> kenv_local = kenv_local * kenv >> >> loop_lt kcount, 2, i_index + 2, loopStart >> >> asig = asig * kenv_local >> >> aout = asig >> >> if (i_index < itablesize - 2) then >> anextsig yi_add_table itable, kenv, kpch, i_index + 2 >> aout = aout + anextsig >> endif >> >> if (i_index == 0) then >> aout balance aout, asig >> endif >> >> xout aout >> >> endop >> >> in this Csound Journal article: >> >> http://www.csounds.com/journal/2006summer/controlFlow_part2.html >> >> Maybe that helps? >> >> steven >> >> >> On Mon, Nov 24, 2008 at 11:58 AM, Rory Walsh wrote: >>> Thanks Steven, changing khrm to an i-rate variable works as one would >>> expect. But using a kgoto doesn't work either. I'm assuming that >>> something like this can be done? >>> >>> Rory. >>> >>> >>> 2008/11/24 Steven Yi : >>>> Hi Rory, >>>> >>>> I think there must be an issue when you change your comparison against >>>> the 10 (constant) to the khrm (k-rate) that the type of goto must be >>>> changing. Could you do a test making khrm as ihrm to see if that >>>> works? >>>> >>>> steven >>>> >>>> On Mon, Nov 24, 2008 at 8:30 AM, Rory Walsh wrote: >>>>> One of my students was asking if there is a version of the the buzz >>>>> opcode that has a fade-in for each harmonic so that pops do not occur >>>>> in the output. I didn't know if there was and couldn't find on in the >>>>> manual so I set about doing a simple UDO for him. Here's what I have, >>>>> the problem is explained below: >>>>> >>>>> opcode testBuzz, a, kikip >>>>> kamp, ifreq, khrm, ifn, icnt xin ; read input parameters >>>>> if (icnt >= 10) goto skip >>>>> kenv linseg 0, 0.1, 1, 1, 1 >>>>> a1 testBuzz kamp*kenv, ifreq, khrm, ifn, icnt+1 >>>>> skip: >>>>> aout oscil kamp/khrm, ifreq*icnt, ifn >>>>> xout (aout+a1) ; write output >>>>> endop >>>>> >>>>> The problem is that if I use khrm instead of 10 in my test against >>>>> icnt, csound will baulks out at init-time. Any suggestions as how can >>>>> I do this? I'm trying to use that hkrm value toset the number of >>>>> harmonics. >>>>> >>>>> Rory. >>>>> >>>>> >>>>> Send bugs reports to this list. >>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" >>>>> >>>> >>>> >>>> Send bugs reports to this list. >>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" >>>> >>> >>> >>> Send bugs reports to this list. >>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" >>> >> >> >> Send bugs reports to this list. >> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" >> >