Csound Csound-dev Csound-tekno Search About

[Csnd] A recursive delay line UDO

Date2023-06-10 09:05
FromPhilipp Neumann
Subject[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
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2023-06-10 11:26
FromST Music
SubjectRe: [Csnd] A recursive delay line UDO
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).

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
;================================
<CsInstruments>

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 

</CsInstruments>
;================================
<CsScore>
i1  0  16
</CsScore>
</CsoundSynthesizer>

Best,
Scott

On Sat, Jun 10, 2023, 4:05 a.m. Philipp Neumann <kontakt@philippneumann.eu> wrote:
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
        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

Date2023-06-10 11:32
FromPhilipp Neumann
SubjectRe: [Csnd] A recursive delay line UDO
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

> Am 10.06.2023 um 12:26 schrieb ST Music :
> 
> 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
> 
> On Sat, Jun 10, 2023, 4:05 a.m. Philipp Neumann  wrote:
> 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
>         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

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

Date2023-06-10 11:50
FromST Music
SubjectRe: [Csnd] A recursive delay line UDO
Hah, I see now! The missing parameter in the if statement.

Yes, a fun little UDO, nice.

Best,
Scott

On Sat, Jun 10, 2023, 6:32 a.m. Philipp Neumann <kontakt@philippneumann.eu> wrote:
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

> Am 10.06.2023 um 12:26 schrieb ST Music <stunes6556@GMAIL.COM>:
>
> 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).
>
> <CsoundSynthesizer>
> <CsOptions>
> -odac
> </CsOptions>
> ;================================
> <CsInstruments>
>
> 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
>
> </CsInstruments>
> ;================================
> <CsScore>
> i1  0  16
> </CsScore>
> </CsoundSynthesizer>
>
> Best,
> Scott
>
> On Sat, Jun 10, 2023, 4:05 a.m. Philipp Neumann <kontakt@philippneumann.eu> wrote:
> 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
>         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

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