Csound Csound-dev Csound-tekno Search About

[Csnd] morphing (and rotating) arrays

Date2024-01-17 14:29
FromJon Nelson
Subject[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
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2024-01-18 10:54
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] [Csnd] morphing (and rotating) arrays
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.
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 17 Jan 2024, at 14:29, Jon Nelson  wrote:
>
> *Warning*
>
> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
>
> 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
>        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