[Csnd] morphing (and rotating) arrays

Dear CSounders:

A student of mine, Christopher Poovey, developed a couple of array manipulation UDOs while doing some work for me a couple of years ago. One UDO rotates an array and the other morphs between two arrays:

opcode arrrot, k[], k[]k ;rotate array
    karr[], kshift xin
    isize = lenarray(karr)
    kout[] init isize
    kcount = 0
        until kcount >= isize do
            kout[kcount] = karr[wrap(kcount+kshift,0,(isize-1))]
            kcount += 1
        od
    xout kout
endop

opcode arrmorph, k[], kk[]k[]i ;morph two arrays
    kfact,k1[],k2[],isize xin
    kout[] init isize
        kout = k1*(1-kfact) + k2*kfact
    xout kout
endop

--Jon

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

That looks very useful, thanks for it. Maybe we should turn this into an opcode?

Also: do we still maintain a UDO database somewhere? That looks like the right place to publish this.