[Csnd] A recursive delay line UDO

Hello Everybody!

Recently i’m experimenting with delay lines and i was thinking about how to get to the extremes and to unusual results. So i also thought about a recursive UDO which creates several delay-lines. But it’s not working as i wish.
This is my UDO:

opcode delayArray, a, akkip
  setksmps 1
  aDelIn, kDelTime, kFdbk, iDelBuf, iInstances xin

  aDelDump delayr iDelBuf
  aDelTap deltap kDelTime
  delayw aDelIn + (aDelTap * kFdbk)
  
  aDelOut limit aDelTap, -1, 1

  print iInstances
  
  if iInstances > 1 then
    aDelOut += delayArray(aDelOut, kDelTime+0.1, kFdbk, iInstances-1)
  endif
    xout aDelOut
endop

And this is what i wish to do:

I want to send a signal to the UDO which then is send to a delay line with feedback. This Signal then i sended into the recursive part till a fixed number of instances is reached.
But this is not working with this. I use print to print my instances - so there i also just get the first and the last. But the whole thing is not working as i thought. Maybe someone can help me?

Greetings,
Philipp
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here

Hi Philipp, I’m pretty new to UDO’s so curious to see where this goes as surely someone understands this better than me.

It looks like maybe the problem is that the recursion, having some k-rate variables, runs the if loop at k-rate or something like that.

At i-rate you see the classic “recursion” print (moving in reverse).

-odac ;================================

sr = 48000
ksmps = 10
nchnls = 1
0dbfs = 1

opcode delayArray, a, aiij
aDelIn, iDelTime, iFdbk, iInstances xin
aDel init 0
aDel = delay(aDelIn + aDel * iFdbk, iDelTime)
aDelOut limit aDel, -1, 1
prints “\nDelay\n”
print iInstances

if iInstances > 1 then
aDelOut += delayArray(aDelOut, iDelTime+0.1, iFdbk, iInstances-1)
print iInstances
endif

xout aDelOut
endop

instr 1
a1 = oscil:a(linseg:a(.4, .3, 0), 220)
aSig delayArray a1, .8, .3, 5
out a1 + aSig
endin

;================================ i1 0 16

Best,
Scott

Hi Scott,

thanks for your reply! I probably solved it and someone else has also some fun with experimenting with this UDO:

opcode delayArray, a, akkip
  setksmps 1
  aDelIn, kDelTime, kFdbk, iDelBuf, iInstances xin

  aDelDump delayr iDelBuf
  aDelTap deltap kDelTime
  delayw aDelIn + (aDelTap * kFdbk)
  
  aDelOut limit aDelTap, -1, 1

  print iInstances
  
  if iInstances > 1 then
    aDelOut += delayArray(aDelOut, kDelTime+0.1, kFdbk, iDelBuf, iInstances-1)
  endif
  
  aDelOut limit aDelOut, -1, 1
    xout aDelOut
endop

Greetings, Philipp

Hah, I see now! The missing parameter in the if statement.

Yes, a fun little UDO, nice.

Best,
Scott