Seeking particular Csound code examples of recursive UDOs.
Date | 2016-07-20 05:20 |
From | Nitram |
Subject | Seeking particular Csound code examples of recursive UDOs. |
Hi to all on the forum. I was wondering if I could ask your advice on something please? I'm searching online for examples of Csound code which uses recursive UDOs. I understand the basics of recursive UDOs, but I'm trying to figure out a way to manipulate and/or retrieve information from each call to itself. For example, looking at the 'Filterbank UDO' by Bhob Rainey; say that I want to create 5 individual bandpass filters, how do I then assign different frequency bands to each?... And later on, how can control the parameters of each discrete band individually? Perhaps someone could point me towards some code online that demonstrates the above (not specifically using the Filterbank UDO)? Thanks in advance! Martin -- View this message in context: http://csound.1045644.n5.nabble.com/Seeking-particular-Csound-code-examples-of-recursive-UDOs-tp5750716.html Sent from the Csound - General mailing list archive at Nabble.com. 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 |
Date | 2016-07-20 12:19 |
From | Rory Walsh |
Subject | Re: Seeking particular Csound code examples of recursive UDOs. |
Here's one by Victor I use for teaching recursion.. On 20 July 2016 at 05:20, Nitram <martcrowl@gmail.com> wrote: Hi to all on the forum. I was wondering if I could ask your advice on |
Date | 2016-07-21 04:33 |
From | Nitram |
Subject | Re: Seeking particular Csound code examples of recursive UDOs. |
Thanks for the link, Rory. I have seen a lot of these examples online, but I've not found the one that I'm after yet. I'm really sorry but, reading back now I don't think my query was specific enough. Perhaps what I'm asking cannot be done. What I'm wondering is, if is it possible to have total control over the variables in each individual call to the opcode within a recursive UDO. For instance, if I create 3 instances of 'oscil' using a recursive UDO, is it possible to have entirely separate control over 'kamp' and 'kcps' of each of these three oscil's from the instrument section afterwards ie. I can alter the settings of pitch and amplitude in each separately, just as if I had created three separate oscil opcodes within an instrument. I hope this made sense. Thanks Martin -- View this message in context: http://csound.1045644.n5.nabble.com/Seeking-particular-Csound-code-examples-of-recursive-UDOs-tp5750716p5750728.html Sent from the Csound - General mailing list archive at Nabble.com. 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 |
Date | 2016-07-21 05:51 |
From | Steven Yi |
Subject | Re: Seeking particular Csound code examples of recursive UDOs. |
One thing you could do is use the channel system. For the UDO, pass in the base name of the channel as a string, then use an index for each recursion. Each UDO could then concatenate the base name, a param name, and a number, then use that with chnget and chnset. You'd have names like "myosc_freq_0" and so on. On Wed, Jul 20, 2016 at 11:33 PM, Nitram <martcrowl@gmail.com> wrote: > Thanks for the link, Rory. I have seen a lot of these examples online, but > I've not found the one that I'm after yet. > > I'm really sorry but, reading back now I don't think my query was specific > enough. > > Perhaps what I'm asking cannot be done. > > What I'm wondering is, if is it possible to have total control over the > variables in each individual call to the opcode within a recursive UDO. > > For instance, if I create 3 instances of 'oscil' using a recursive UDO, is > it possible to have entirely separate control over 'kamp' and 'kcps' of each > of these three oscil's from the instrument section afterwards ie. I can > alter the settings of pitch and amplitude in each separately, just as if I > had created three separate oscil opcodes within an instrument. > > I hope this made sense. > > Thanks > > Martin > > > > > > -- > View this message in context: http://csound.1045644.n5.nabble.com/Seeking-particular-Csound-code-examples-of-recursive-UDOs-tp5750716p5750728.html > Sent from the Csound - General mailing list archive at Nabble.com. > > 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 |
Date | 2016-07-21 10:25 | ||
From | Iain McCurdy | ||
Subject | Re: Seeking particular Csound code examples of recursive UDOs. | ||
In the example UDO Rory linked to, there is a variable icnt which counts the iterations. If you want individual control for a parameter in each iteration then write these values sequentially into an array within an instrument. The UDO iterations can then retrieve their respective values from the array using icnt as an index into the array. I hope this helps, Iain From: A discussion list for users of Csound <CSOUND@LISTSERV.HEANET.IE> on behalf of Nitram <martcrowl@GMAIL.COM>
Sent: 21 July 2016 03:33 To: CSOUND@LISTSERV.HEANET.IE Subject: Re: [Csnd] Seeking particular Csound code examples of recursive UDOs. Thanks for the link, Rory. I have seen a lot of these examples online, but
I've not found the one that I'm after yet. I'm really sorry but, reading back now I don't think my query was specific enough. Perhaps what I'm asking cannot be done. What I'm wondering is, if is it possible to have total control over the variables in each individual call to the opcode within a recursive UDO. For instance, if I create 3 instances of 'oscil' using a recursive UDO, is it possible to have entirely separate control over 'kamp' and 'kcps' of each of these three oscil's from the instrument section afterwards ie. I can alter the settings of pitch and amplitude in each separately, just as if I had created three separate oscil opcodes within an instrument. I hope this made sense. Thanks Martin -- View this message in context: http://csound.1045644.n5.nabble.com/Seeking-particular-Csound-code-examples-of-recursive-UDOs-tp5750716p5750728.html
Sent from the Csound - General mailing list archive at Nabble.com. 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 |
Date | 2016-07-21 19:45 |
From | Ffanci Silvain |
Subject | Re: Seeking particular Csound code examples of recursive UDOs. |
Iain McCurdy, Jul 21 2016: > In the example UDO Rory linked to, there is a variable icnt which counts the iterations. If you want individual control for a parameter in each iteration then write these values sequentially into an array within an instrument. The UDO iterations can then retrieve their respective values from the array using icnt as an index into the array. Or create a global table, if recursion info in your context can be global. Another idea - though not very ellegant - is to create two UDOs: one to be called by the user with only a few parameters and a second one with more parameters, that will be called and initialised from the "outer" UDO. Otherwise a UDO with default values - as shown in the linked example - is feasible. Just thinking aloud... ... Ta-ta, ---- Ffanci * Homepage: https://freeshell.de/~silvain * Twitter: http://twitter.com/ffanci_silvain * GitHub: https://github.com/fsilvain 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 |
Date | 2016-07-26 23:13 |
From | Nitram |
Subject | Re: Seeking particular Csound code examples of recursive UDOs. |
Thanks for the tips Steven, Iain and Ffanci. I'm (slowly) getting there. Many thanks for taking the time to suggest some of these solutions to my issue:) On Thu, Jul 21, 2016 at 7:46 PM, Ffanci Silvain [via Csound] <[hidden email]> wrote: Iain McCurdy, Jul 21 2016: View this message in context: Re: [Csnd] Seeking particular Csound code examples of recursive UDOs. Sent from the Csound - General mailing list archive at Nabble.com. 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 |
Date | 2016-07-27 06:42 |
From | Nitram |
Subject | Re: Seeking particular Csound code examples of recursive UDOs. |
Hello again. So, Ive had success using arrays to allow two Cabbage sliders to control the different pitch of both calls to my UDO independently: <Cabbage> #define FreqSlider range(0, 20000, 440, 1, 0.01), trackercolour(9, 214, 214, 128), colour(0, 0, 0, 255) form size(650, 300), caption("Channel System Experiment Recursion"), pluginID("plu1") vslider bounds(72, 0, 111, 267), channel("freq1"), $FreqSlider vslider bounds(142, 0, 111, 267), channel("freq2"), $FreqSlider </Cabbage> <CsoundSynthesizer> <CsOptions> -n -d -+rtmidi=NULL -M0 -m0d </CsOptions> <CsInstruments> sr = 44100 ksmps = 128 nchnls = 2 0dbfs = 1.0 opcode manyoscs, a, k[]o kfreq[], iindex xin ; Evaluates the size or number of dimensions of an array. inum = lenarray(kfreq) ; kfreq = The array that is being questioned. ; inum = length of vector aoscilout oscil 0.9, kfreq[iindex] if (iindex <= (inum-1)) then amanyoscsout manyoscs kfreq, iindex+1 afinalout = aoscilout + amanyoscsout endif xout afinalout endop instr 1 kfreq[] init 3 icnt = 1 kfreq[0] chnget "freq1" kfreq[1] chnget "freq2" aout manyoscs kfreq, icnt -1 printk2 kfreq[0] printk2 kfreq[1] outs aout*0.1, aout*0.1 endin </CsInstruments> <CsScore> f0 z i1 0 200000 </CsScore> </CsoundSynthesizer> I then wanted to create a widget array for these two sliders and I figured the best place to put that was within the recursive UDO itself. However, I have failed in my efforts so far to allow control over the calls to the UDO as before. Below is an example of some of the various configurations I have tried... <Cabbage> #define FreqSlider range(0, 20000, 440, 1, 0.01), trackercolour(9, 214, 214, 128), colour(0, 0, 0, 255) form size(650, 600), caption("Channel System Experiment Recursion"), pluginID("plu1") vslider bounds(142, 0, 111, 267), widgetarray("freq", 2), $FreqSlider </Cabbage> <CsoundSynthesizer> <CsOptions> -n -d -+rtmidi=NULL -M0 -m0d </CsOptions> <CsInstruments> sr = 44100 ksmps = 128 nchnls = 2 0dbfs = 1.0 opcode manyoscs, a, k[]o kfreq[], iindex xin inum = lenarray(kfreq) iCntRows init 0 aoscilout oscil 0.9, kfreq[iindex] if (iindex <= (inum-1)) then until iindex > inum do S1 sprintfk "pos(%d, %d)", iindex%2*200+100, 0 ; *X-axis distance+offset / Y-axis Offset ("0") S2 sprintfk "freq_ident%d", iindex+1 ; (counts through the identchannels) chnset S1, S2 ; (sends the new position information) iindex=iindex+1 enduntil amanyoscsout manyoscs kfreq, iindex+1 afinalout = aoscilout + amanyoscsout endif xout afinalout endop instr 1 icnt init 0 kfreq[] init 3 until icnt > 2 do kfreq[icnt] chnget sprintfk("freq%d", icnt+1) icnt=icnt+1 aout manyoscs kfreq, icnt enduntil printk2 kfreq[0] printk2 kfreq[1] outs aout*0.5, aout*0.5 endin </CsInstruments> <CsScore> f0 z i1 0 200000 </CsScore> </CsoundSynthesizer> I'm clearly doing something (or a few things) very wrong. I'd be thrilled to get some tips please and thanks:) On Tue, Jul 26, 2016 at 11:13 PM, Martin Crowley <[hidden email]> wrote:
View this message in context: Re: [Csnd] Seeking particular Csound code examples of recursive UDOs. Sent from the Csound - General mailing list archive at Nabble.com. 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 |
Date | 2016-07-27 08:33 |
From | Iain McCurdy |
Subject | Re: Seeking particular Csound code examples of recursive UDOs. |
I think the problem is an i-rate / k-rate mismatch. You are trying to evaluate the k-rate chnset multiple times within an i-rate loop. You can write the channels into the array like this:
<Cabbage>
#define FreqSlider range(0, 20000, 440, 1, 0.01), trackercolour(9, 214, 214, 128), colour(0, 0, 0, 255)
form size(650, 600), caption("Channel System Experiment Recursion"), pluginID("plu1")
vslider bounds(142, 0, 111, 267), widgetarray("freq", 2), $FreqSlider
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1.0
icnt =
0
until icnt > 1 do
chnset sprintf("pos(%d,0)",142+icnt*80),sprintf("freq_ident%d",icnt+1)
icnt += 1
enduntil
instr 1
kfreq[] init 2
kcnt =
0
loop:
kfreq[kcnt] chnget
sprintfk("freq%d",kcnt+1)
loop_lt kcnt,1,2,loop
printk2 kfreq[0]
printk2 kfreq[1]
endin
</CsInstruments>
<CsScore>
i1 0 200000
</CsScore>
</CsoundSynthesizer>
Iain.
From: A discussion list for users of Csound <CSOUND@LISTSERV.HEANET.IE> on behalf of Nitram <martcrowl@GMAIL.COM>
Sent: 27 July 2016 05:42 To: CSOUND@LISTSERV.HEANET.IE Subject: Re: [Csnd] Seeking particular Csound code examples of recursive UDOs. Hello again. So, Ive had success using arrays to allow two Cabbage sliders to control the different pitch of both calls to my UDO independently:
<Cabbage>
#define FreqSlider range(0, 20000, 440, 1, 0.01), trackercolour(9, 214, 214, 128), colour(0, 0, 0, 255)
form size(650, 300), caption("Channel System Experiment Recursion"), pluginID("plu1")
vslider bounds(72, 0, 111, 267), channel("freq1"), $FreqSlider
vslider bounds(142, 0, 111, 267), channel("freq2"), $FreqSlider
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1.0
opcode
manyoscs, a, k[]o
kfreq[], iindex xin
; Evaluates the size or number of dimensions of an array.
inum = lenarray(kfreq) ; kfreq = The array that is being questioned.
; inum = length of vector
aoscilout oscil 0.9, kfreq[iindex]
if (iindex <= (inum-1)) then
amanyoscsout manyoscs kfreq, iindex+1
afinalout = aoscilout + amanyoscsout
endif
xout afinalout
endop
instr 1
kfreq[] init 3
icnt = 1
kfreq[0] chnget "freq1"
kfreq[1] chnget "freq2"
aout manyoscs kfreq, icnt -1
printk2 kfreq[0]
printk2 kfreq[1]
outs aout*0.1, aout*0.1
endin
</CsInstruments>
<CsScore>
f0 z
i1 0 200000
</CsScore>
</CsoundSynthesizer>
I then wanted to create a widget array for these two sliders and I figured the best place to put that was within the recursive UDO itself. However, I have failed in my efforts so far to allow control over the calls to the UDO as before. Below is an example
of some of the various configurations I have tried...
<Cabbage>
#define FreqSlider range(0, 20000, 440, 1, 0.01), trackercolour(9, 214, 214, 128), colour(0, 0, 0, 255)
form size(650, 600), caption("Channel System Experiment Recursion"), pluginID("plu1")
vslider bounds(142, 0, 111, 267), widgetarray("freq", 2), $FreqSlider
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1.0
opcode
manyoscs, a, k[]o
kfreq[], iindex xin
inum = lenarray(kfreq)
iCntRows init 0
aoscilout oscil 0.9, kfreq[iindex]
if (iindex <= (inum-1)) then
until iindex > inum do
S1 sprintfk "pos(%d, %d)", iindex%2*200+100, 0
; *X-axis distance+offset / Y-axis Offset ("0")
S2 sprintfk "freq_ident%d", iindex+1
; (counts through the identchannels)
chnset S1, S2
; (sends the new position information)
iindex=iindex+1
enduntil
amanyoscsout manyoscs kfreq, iindex+1
afinalout = aoscilout + amanyoscsout
endif
xout afinalout
endop
instr 1
icnt init 0
kfreq[] init 3
until icnt > 2 do
kfreq[icnt] chnget sprintfk("freq%d", icnt+1)
icnt=icnt+1
aout manyoscs kfreq, icnt
enduntil
printk2 kfreq[0]
printk2 kfreq[1]
outs aout*0.5, aout*0.5
endin
</CsInstruments>
<CsScore>
f0 z
i1 0 200000
</CsScore>
</CsoundSynthesizer>
I'm clearly doing something (or a few things) very wrong. I'd be thrilled to get some tips please and thanks:)
On Tue, Jul 26, 2016 at 11:13 PM, Martin Crowley
<[hidden email]> wrote:
View this message in context: Re: [Csnd] Seeking particular Csound code examples of recursive UDOs. Sent from the Csound - General mailing list archive at Nabble.com. 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 |
Date | 2016-07-27 15:12 |
From | Nitram |
Subject | Re: Seeking particular Csound code examples of recursive UDOs. |
Many thanks Iain:) I'll try this code out to see where I was going wrong. -- View this message in context: http://csound.1045644.n5.nabble.com/Seeking-particular-Csound-code-examples-of-recursive-UDOs-tp5750716p5750844.html Sent from the Csound - General mailing list archive at Nabble.com. 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 |