Csound Csound-dev Csound-tekno Search About

[Csnd] Strings as variable names?

Date2020-12-17 12:29
FromAnders Genell
Subject[Csnd] Strings as variable names?
Hi all!
I dont know if this is a stupid question but could not find a mention about this usecase.
Can a string somehow be used as a variable name? Something like

Sname strcpy "asig"

Sname poscil3 .5, 440, 1


My idea was to be able to determine variable names through a command line --omacro flag.

Regards,
Anders
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

Date2020-12-17 15:09
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Strings as variable names?
If you want to something like

$OUT oscili $AMP, $FREQ

then it should work without the need of any extra feature.

========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 17 Dec 2020, at 12:29, Anders Genell  wrote:
> 
> WARNINGThis 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.
> Hi all!
> I dont know if this is a stupid question but could not find a mention about this usecase.
> Can a string somehow be used as a variable name? Something like
> 
> Sname strcpy "asig"
> 
> Sname poscil3 .5, 440, 1
> 
> 
> My idea was to be able to determine variable names through a command line --omacro flag.
> 
> Regards,
> Anders
> 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

Date2020-12-17 18:55
FromAnders Genell
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Strings as variable names?
Well, that should work just fine!
Thanks!

I was trying to do something uselessly complicated...

Just out of curiosity though, would it be possible to generate variable names automatically and assign values to them?
Can numbers be converted to strings?
something like

indx init 1
if (indx <= 10) then 
    Saoutn strcat "aout", number_to_string(indx)
    indx=indx+1    
endif

regard_as_variable(Saoutn) poscil3 0.1, 440, 1


Regards,
Anders


On Thu, Dec 17, 2020 at 4:09 PM Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
If you want to something like

$OUT oscili $AMP, $FREQ

then it should work without the need of any extra feature.

========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 17 Dec 2020, at 12:29, Anders Genell <anders.genell@gmail.com> wrote:
>
> WARNINGThis 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.
> Hi all!
> I dont know if this is a stupid question but could not find a mention about this usecase.
> Can a string somehow be used as a variable name? Something like
>
> Sname strcpy "asig"
>
> Sname poscil3 .5, 440, 1
>
>
> My idea was to be able to determine variable names through a command line --omacro flag.
>
> Regards,
> Anders
> 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

Date2020-12-17 19:59
Fromjoachim heintz
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Strings as variable names?
perhaps strget and strset?



On 17/12/2020 19:55, Anders Genell wrote:
> Well, that should work just fine!
> Thanks!
> 
> I was trying to do something uselessly complicated...
> 
> Just out of curiosity though, would it be possible to generate variable 
> names automatically and assign values to them?
> Can numbers be converted to strings?
> something like
> 
> indx init 1
> if (indx <= 10) then
>      Saoutn strcat "aout", number_to_string(indx)
>      indx=indx+1
> endif
> 
> regard_as_variable(Saoutn) poscil3 0.1, 440, 1
> 
> 
> Regards,
> Anders
> 
> 
> On Thu, Dec 17, 2020 at 4:09 PM Victor Lazzarini  > wrote:
> 
>     If you want to something like
> 
>     $OUT oscili $AMP, $FREQ
> 
>     then it should work without the need of any extra feature.
> 
>     ========================
>     Prof. Victor Lazzarini
>     Maynooth University
>     Ireland
> 
>      > On 17 Dec 2020, at 12:29, Anders Genell      > wrote:
>      >
>      > WARNINGThis 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.
>      > Hi all!
>      > I dont know if this is a stupid question but could not find a
>     mention about this usecase.
>      > Can a string somehow be used as a variable name? Something like
>      >
>      > Sname strcpy "asig"
>      >
>      > Sname poscil3 .5, 440, 1
>      >
>      >
>      > My idea was to be able to determine variable names through a
>     command line --omacro flag.
>      >
>      > Regards,
>      > Anders
>      > 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

Date2020-12-17 21:17
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] [Csnd] Strings as variable names?
and sprintf

Prof. Victor Lazzarini
Maynooth University
Ireland

> On Dec 17, 2020, at 7:59 PM, joachim heintz  wrote:
> 
> perhaps strget and strset?
> 
> 
> 
>> On 17/12/2020 19:55, Anders Genell wrote:
>> Well, that should work just fine!
>> Thanks!
>> I was trying to do something uselessly complicated...
>> Just out of curiosity though, would it be possible to generate variable names automatically and assign values to them?
>> Can numbers be converted to strings?
>> something like
>> indx init 1
>> if (indx <= 10) then
>>     Saoutn strcat "aout", number_to_string(indx)
>>     indx=indx+1
>> endif
>> regard_as_variable(Saoutn) poscil3 0.1, 440, 1
>> Regards,
>> Anders
>> On Thu, Dec 17, 2020 at 4:09 PM Victor Lazzarini > wrote:
>>    If you want to something like
>>    $OUT oscili $AMP, $FREQ
>>    then it should work without the need of any extra feature.
>>    ========================
>>    Prof. Victor Lazzarini
>>    Maynooth University
>>    Ireland
>>     > On 17 Dec 2020, at 12:29, Anders Genell >    > wrote:
>>     >
>>     > WARNINGThis 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.
>>     > Hi all!
>>     > I dont know if this is a stupid question but could not find a
>>    mention about this usecase.
>>     > Can a string somehow be used as a variable name? Something like
>>     >
>>     > Sname strcpy "asig"
>>     >
>>     > Sname poscil3 .5, 440, 1
>>     >
>>     >
>>     > My idea was to be able to determine variable names through a
>>    command line --omacro flag.
>>     >
>>     > Regards,
>>     > Anders
>>     > Csound mailing list Csound@listserv.heanet.ie
>>    
>>    https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=04%7C01%7CVictor.Lazzarini%40mu.ie%7C3508fcd901bd4b4948f108d8a2c64439%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637438319723117227%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=w6yO2jMyeXowxxo7Cm3lsWryHRug%2B4GtXR6AK8fXfNs%3D&reserved=0 Send bugs reports to
>>    https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=04%7C01%7CVictor.Lazzarini%40mu.ie%7C3508fcd901bd4b4948f108d8a2c64439%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637438319723117227%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=lqrzPWXi8yfbQTU%2BtUXxYqGkg1%2FwGodCzD4zSCppe30%3D&reserved=0 Discussions of bugs and
>>    features can be posted here
>>    Csound mailing list
>>    Csound@listserv.heanet.ie 
>>    https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=04%7C01%7CVictor.Lazzarini%40mu.ie%7C3508fcd901bd4b4948f108d8a2c64439%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637438319723117227%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=w6yO2jMyeXowxxo7Cm3lsWryHRug%2B4GtXR6AK8fXfNs%3D&reserved=0
>>    Send bugs reports to
>>    https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=04%7C01%7CVictor.Lazzarini%40mu.ie%7C3508fcd901bd4b4948f108d8a2c64439%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637438319723117227%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=lqrzPWXi8yfbQTU%2BtUXxYqGkg1%2FwGodCzD4zSCppe30%3D&reserved=0
>>    Discussions of bugs and features can be posted here
>> Csound mailing list Csound@listserv.heanet.ie  https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=04%7C01%7CVictor.Lazzarini%40mu.ie%7C3508fcd901bd4b4948f108d8a2c64439%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637438319723127224%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=UhgwUq1m6ivOIgVnMzvtDE8l9HXphn8z5J7S9TqmuRE%3D&reserved=0 Send bugs reports to https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=04%7C01%7CVictor.Lazzarini%40mu.ie%7C3508fcd901bd4b4948f108d8a2c64439%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637438319723127224%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=VXEYPvMbVKPzEZhGJ%2Ba0gKGWbx8z7IDysijGL%2F%2BmP7A%3D&reserved=0 Discussions of bugs and features can be posted here
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=04%7C01%7CVictor.Lazzarini%40mu.ie%7C3508fcd901bd4b4948f108d8a2c64439%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637438319723127224%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=UhgwUq1m6ivOIgVnMzvtDE8l9HXphn8z5J7S9TqmuRE%3D&reserved=0
> Send bugs reports to
>       https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=04%7C01%7CVictor.Lazzarini%40mu.ie%7C3508fcd901bd4b4948f108d8a2c64439%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637438319723127224%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=VXEYPvMbVKPzEZhGJ%2Ba0gKGWbx8z7IDysijGL%2F%2BmP7A%3D&reserved=0
> 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