Csound Csound-dev Csound-tekno Search About

[Csnd] Dynamically creating a variables

Date2017-12-08 21:19
Fromchronopolis
Subject[Csnd] Dynamically creating a variables
I have the following block that I would like optimize into a loop to reduce
repetition. I can put most of the arguments in an array but am struggling
with dynamically creating the aSig vars.

	        aSig1L syncloop 1, kfreq1, kpitch1, kgrsize1, ips*kstr1, 0, 60,
giL[0], 1, iolaps
		aSig1R syncloop 1, kfreq1, kpitch1, kgrsize1, ips*kstr1, 0, 60, giR[0], 1,
iolaps
		aSig2L syncloop 1, kfreq2, kpitch2, kgrsize2, ips*kstr2, 0, 60, giL[1], 1,
iolaps
		aSig2R syncloop 1, kfreq2, kpitch2, kgrsize2, ips*kstr2, 0, 60, giR[1], 1,
iolaps
		aSig3L syncloop 1, kfreq3, kpitch3, kgrsize3, ips*kstr3, 0, 60, giL[2], 1,
iolaps
		aSig3R syncloop 1, kfreq3, kpitch3, kgrsize3, ips*kstr3, 0, 60, giR[2], 1,
iolaps
		aSig4L syncloop 1, kfreq4, kpitch4, kgrsize4, ips*kstr4, 0, 60, giL[3], 1,
iolaps
		aSig4R syncloop 1, kfreq4, kpitch4, kgrsize4, ips*kstr4, 0, 60, giR[3], 1,
iolaps

I tried putting aSig in an array and iterating over it but ran into only
errors after many hours of working on it. Does anyone have a suggestion?

Thanks! 



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2017-12-13 00:24
FromSteven Yi
SubjectRe: [Csnd] Dynamically creating a variables
For a dynamic range of asig vars, I would probably look at using a
recursive user-defined opcode. Each call in the recursion could sum
the output of calls to syncloop pairs together with the output of the
recursive call.  I'm not sure that's clear; if not, if you could post
a fuller example with giL and giR definition then could probably help
out here.

On Fri, Dec 8, 2017 at 4:19 PM, chronopolis  wrote:
> I have the following block that I would like optimize into a loop to reduce
> repetition. I can put most of the arguments in an array but am struggling
> with dynamically creating the aSig vars.
>
>                 aSig1L syncloop 1, kfreq1, kpitch1, kgrsize1, ips*kstr1, 0, 60,
> giL[0], 1, iolaps
>                 aSig1R syncloop 1, kfreq1, kpitch1, kgrsize1, ips*kstr1, 0, 60, giR[0], 1,
> iolaps
>                 aSig2L syncloop 1, kfreq2, kpitch2, kgrsize2, ips*kstr2, 0, 60, giL[1], 1,
> iolaps
>                 aSig2R syncloop 1, kfreq2, kpitch2, kgrsize2, ips*kstr2, 0, 60, giR[1], 1,
> iolaps
>                 aSig3L syncloop 1, kfreq3, kpitch3, kgrsize3, ips*kstr3, 0, 60, giL[2], 1,
> iolaps
>                 aSig3R syncloop 1, kfreq3, kpitch3, kgrsize3, ips*kstr3, 0, 60, giR[2], 1,
> iolaps
>                 aSig4L syncloop 1, kfreq4, kpitch4, kgrsize4, ips*kstr4, 0, 60, giL[3], 1,
> iolaps
>                 aSig4R syncloop 1, kfreq4, kpitch4, kgrsize4, ips*kstr4, 0, 60, giR[3], 1,
> iolaps
>
> I tried putting aSig in an array and iterating over it but ran into only
> errors after many hours of working on it. Does anyone have a suggestion?
>
> Thanks!
>
>
>
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
> 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

Date2017-12-13 00:32
FromJohn ff
SubjectRe: [Csnd] Dynamically creating a variables
Macros are the other way of generating names

Sent from Blue
On 13 Dec 2017, at 00:25, Steven Yi <stevenyi@GMAIL.COM> wrote:
For a dynamic range of asig vars, I would probably look at using a
recursive user-defined opcode. Each call in the recursion could sum
the output of calls to syncloop pairs together with the output of the
recursive call. I'm not sure that's clear; if not, if you could post
a fuller example with giL and giR definition then could probably help
out here.

On Fri, Dec 8, 2017 at 4:19 PM, chronopolis <micah.frank@gmail.com> wrote:
I have the following block that I would like optimize into a loop to reduce
repetition. I can put most of the arguments in an array but am struggling
with dynamically creating the aSig vars.

aSig1L syncloop 1, kfreq1, kpitch1, kgrsize1, ips*kstr1, 0, 60,
giL[0], 1, iolaps
aSig1R syncloop 1, kfreq1, kpitch1, kgrsize1, ips*kstr1, 0, 60, giR[0], 1,
iolaps
aSig2L syncloop 1, kfreq2, kpitch2, kgrsize2, ips*kstr2, 0, 60, giL[1], 1,
iolaps
aSig2R syncloop 1, kfreq2, kpitch2, kgrsize2, ips*kstr2, 0, 60, giR[1], 1,
iolaps
aSig3L syncloop 1, kfreq3, kpitch3, kgrsize3, ips*kstr3, 0, 60, giL[2], 1,
iolaps
aSig3R syncloop 1, kfreq3, kpitch3, kgrsize3, ips*kstr3, 0, 60, giR[2], 1,
iolaps
aSig4L syncloop 1, kfreq4, kpitch4, kgrsize4, ips*kstr4, 0, 60, giL[3], 1,
iolaps
aSig4R syncloop 1, kfreq4, kpitch4, kgrsize4, ips*kstr4, 0, 60, giR[3], 1,
iolaps

I tried putting aSig in an array and iterating over it but ran into only
errors after many hours of working on it. Does anyone have a suggestion?

Thanks!



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2017-12-13 01:51
FromSteven Yi
SubjectRe: [Csnd] Dynamically creating a variables
Another though, maybe I misread the email. Maybe you meant to have
something like:

aSigL[] init 4
aSigR[] init 4

aSigL[0] syncloop 1, kfreq1, kpitch1, kgrsize1, ips*kstr1, 0, 60,
giL[0], 1, iolaps
aSigR[0] syncloop 1, kfreq1, kpitch1, kgrsize1, ips*kstr1, 0, 60, giR[0], 1,
iolaps
...



On Tue, Dec 12, 2017 at 7:32 PM, John ff  wrote:
> Macros are the other way of generating names
>
> Sent from Blue
> On 13 Dec 2017, at 00:25, Steven Yi  wrote:
>>
>> For a dynamic range of asig vars, I would probably look at using a
>> recursive user-defined opcode. Each call in the recursion could sum
>> the output of calls to syncloop pairs together with the output of the
>> recursive call.  I'm not sure that's clear; if not, if you could post
>> a fuller example with giL and giR definition then could probably help
>> out here.
>>
>> On Fri, Dec 8, 2017 at 4:19 PM, chronopolis  wrote:
>>>
>>>  I have the following block that I would like optimize into a loop to
>>> reduce
>>>  repetition. I can put most of the arguments in an array but am
>>> struggling
>>>  with dynamically creating the aSig vars.
>>>
>>>                  aSig1L syncloop 1, kfreq1, kpitch1, kgrsize1, ips*kstr1,
>>> 0, 60,
>>>  giL[0], 1, iolaps
>>>                  aSig1R syncloop 1, kfreq1, kpitch1, kgrsize1, ips*kstr1,
>>> 0, 60, giR[0], 1,
>>>  iolaps
>>>                  aSig2L syncloop 1, kfreq2, kpitch2, kgrsize2, ips*kstr2,
>>> 0, 60, giL[1], 1,
>>>  iolaps
>>>                  aSig2R syncloop 1, kfreq2, kpitch2, kgrsize2, ips*kstr2,
>>> 0, 60, giR[1], 1,
>>>  iolaps
>>>                  aSig3L syncloop 1, kfreq3, kpitch3, kgrsize3, ips*kstr3,
>>> 0, 60, giL[2], 1,
>>>  iolaps
>>>                  aSig3R syncloop 1, kfreq3, kpitch3, kgrsize3, ips*kstr3,
>>> 0, 60, giR[2], 1,
>>>  iolaps
>>>                  aSig4L syncloop 1, kfreq4, kpitch4, kgrsize4, ips*kstr4,
>>> 0, 60, giL[3], 1,
>>>  iolaps
>>>                  aSig4R syncloop 1, kfreq4, kpitch4, kgrsize4, ips*kstr4,
>>> 0, 60, giR[3], 1,
>>>  iolaps
>>>
>>>  I tried putting aSig in an array and iterating over it but ran into only
>>>  errors after many hours of working on it. Does anyone have a suggestion?
>>>
>>>  Thanks!
>>>
>>>
>>>
>>>  --
>>>  Sent from:
>>> http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>>>
>>>  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

Date2017-12-13 20:24
Fromchronopolis
SubjectRe: [Csnd] Dynamically creating a variables
Yes, thanks Steven - I ended up indexing from an array as you suggested. It
works!

Thanks!



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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