Csound Csound-dev Csound-tekno Search About

[Csnd] Passing ftable names via score

Date2019-03-25 01:38
FromPeter Burgess
Subject[Csnd] Passing ftable names via score
Hi Csounders,
Is it possible to pass an ftables variable name string via the score as a p value and somehow use that string usefully on the other side to name the ftable variable and store it's value? 

I have a situation on which passing the ftable f value via the score will be an absolute nightmare (at best) that will be incredible hard to debug... I can explain why if need be but the explanation will take some typing (I think?) and I wish to avoid throwing a long winded question at you guys if possible...

Pete
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

Date2019-03-25 01:47
FromSteven Yi
SubjectRe: [Csnd] Passing ftable names via score
No, there is no way to eval a string to lookup a value of a variable. You can though use the channel system like a map and store an ftable number as the value for a named channel. i.e.,

chnset(ftgen(0,0,65536, 10, 1), "tabSine")

would generate an ftable using ftgen that creates an ftable number and store it as "tabSine".  You could then pass a string from score and should be able to do a lookup of the ftable number via:

StabName = p4
chnget(p4)



On Sun, Mar 24, 2019 at 9:39 PM Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Hi Csounders,
Is it possible to pass an ftables variable name string via the score as a p value and somehow use that string usefully on the other side to name the ftable variable and store it's value? 

I have a situation on which passing the ftable f value via the score will be an absolute nightmare (at best) that will be incredible hard to debug... I can explain why if need be but the explanation will take some typing (I think?) and I wish to avoid throwing a long winded question at you guys if possible...

Pete
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

Date2019-03-25 01:54
FromPeter Burgess
SubjectRe: [Csnd] Passing ftable names via score
That's an interesting solution, and I believe would work within the parameters of my rather complex (and as yet unstated) problem... Not ideal, but much better than anything I've thought of. What's the overhead if I have hundreds of channels set simply to store ftable strings that never otherwise get set? Would it be much more overhead than setting and using normal variables?

Cheers Steve, Pete

On Mon, 25 Mar 2019, 01:47 Steven Yi, <stevenyi@gmail.com> wrote:
No, there is no way to eval a string to lookup a value of a variable. You can though use the channel system like a map and store an ftable number as the value for a named channel. i.e.,

chnset(ftgen(0,0,65536, 10, 1), "tabSine")

would generate an ftable using ftgen that creates an ftable number and store it as "tabSine".  You could then pass a string from score and should be able to do a lookup of the ftable number via:

StabName = p4
chnget(p4)



On Sun, Mar 24, 2019 at 9:39 PM Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Hi Csounders,
Is it possible to pass an ftables variable name string via the score as a p value and somehow use that string usefully on the other side to name the ftable variable and store it's value? 

I have a situation on which passing the ftable f value via the score will be an absolute nightmare (at best) that will be incredible hard to debug... I can explain why if need be but the explanation will take some typing (I think?) and I wish to avoid throwing a long winded question at you guys if possible...

Pete
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

Date2019-03-25 02:00
FromPeter Burgess
SubjectRe: [Csnd] Passing ftable names via score
I wonder also, would it be possible to write an opcode that takes a string parameter and outputs the value of the variable with that name? Can opcodes potentially access that kind of information? I know that's quite a hacky thing to do, but would be an absolute lifesaver for my current situation.

Pete

On Mon, 25 Mar 2019, 01:54 Peter Burgess, <pete.soundtechnician@gmail.com> wrote:
That's an interesting solution, and I believe would work within the parameters of my rather complex (and as yet unstated) problem... Not ideal, but much better than anything I've thought of. What's the overhead if I have hundreds of channels set simply to store ftable strings that never otherwise get set? Would it be much more overhead than setting and using normal variables?

Cheers Steve, Pete

On Mon, 25 Mar 2019, 01:47 Steven Yi, <stevenyi@gmail.com> wrote:
No, there is no way to eval a string to lookup a value of a variable. You can though use the channel system like a map and store an ftable number as the value for a named channel. i.e.,

chnset(ftgen(0,0,65536, 10, 1), "tabSine")

would generate an ftable using ftgen that creates an ftable number and store it as "tabSine".  You could then pass a string from score and should be able to do a lookup of the ftable number via:

StabName = p4
chnget(p4)



On Sun, Mar 24, 2019 at 9:39 PM Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Hi Csounders,
Is it possible to pass an ftables variable name string via the score as a p value and somehow use that string usefully on the other side to name the ftable variable and store it's value? 

I have a situation on which passing the ftable f value via the score will be an absolute nightmare (at best) that will be incredible hard to debug... I can explain why if need be but the explanation will take some typing (I think?) and I wish to avoid throwing a long winded question at you guys if possible...

Pete
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

Date2019-03-25 11:22
Fromthorin kerr
SubjectRe: [Csnd] Passing ftable names via score
Except...  there is the evalstr opcode. 

Does this example 'do something useful' with the string in the score?

<CsoundSynthesizer>
<CsOptions>
-odac --nchnls=2 --0dbfs=1 --nodisplays --sample-rate=48000 --ksmps=10 
</CsOptions>
<CsInstruments>

giTone ftgen 0, 0, 2048, 10, 1, 0.777, 0.333

instr 1
Seval = p6

icompiled evalstr strcat("return ", Seval)

aout oscil p4, p5, icompiled
outs aout, aout        
endin

</CsInstruments>
<CsScore>
i1 0 3 0.7 440 "giTone"
e
</CsScore>
</CsoundSynthesizer>



On Mon, 25 Mar. 2019, 11:47 am Steven Yi, <stevenyi@gmail.com> wrote:
No, there is no way to eval a string to lookup a value of a variable. You can though use the channel system like a map and store an ftable number as the value for a named channel. i.e.,

chnset(ftgen(0,0,65536, 10, 1), "tabSine")

would generate an ftable using ftgen that creates an ftable number and store it as "tabSine".  You could then pass a string from score and should be able to do a lookup of the ftable number via:

StabName = p4
chnget(p4)



On Sun, Mar 24, 2019 at 9:39 PM Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Hi Csounders,
Is it possible to pass an ftables variable name string via the score as a p value and somehow use that string usefully on the other side to name the ftable variable and store it's value? 

I have a situation on which passing the ftable f value via the score will be an absolute nightmare (at best) that will be incredible hard to debug... I can explain why if need be but the explanation will take some typing (I think?) and I wish to avoid throwing a long winded question at you guys if possible...

Pete
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

Date2019-03-25 12:57
FromPeter Burgess
SubjectRe: [Csnd] Passing ftable names via score
Oh! Well that looks like exactly what I need. I'll investigate that when I'm home. Cheers Thorin

On Mon, 25 Mar 2019, 11:22 thorin kerr, <thorin.kerr@gmail.com> wrote:
Except...  there is the evalstr opcode. 

Does this example 'do something useful' with the string in the score?

<CsoundSynthesizer>
<CsOptions>
-odac --nchnls=2 --0dbfs=1 --nodisplays --sample-rate=48000 --ksmps=10 
</CsOptions>
<CsInstruments>

giTone ftgen 0, 0, 2048, 10, 1, 0.777, 0.333

instr 1
Seval = p6

icompiled evalstr strcat("return ", Seval)

aout oscil p4, p5, icompiled
outs aout, aout        
endin

</CsInstruments>
<CsScore>
i1 0 3 0.7 440 "giTone"
e
</CsScore>
</CsoundSynthesizer>



On Mon, 25 Mar. 2019, 11:47 am Steven Yi, <stevenyi@gmail.com> wrote:
No, there is no way to eval a string to lookup a value of a variable. You can though use the channel system like a map and store an ftable number as the value for a named channel. i.e.,

chnset(ftgen(0,0,65536, 10, 1), "tabSine")

would generate an ftable using ftgen that creates an ftable number and store it as "tabSine".  You could then pass a string from score and should be able to do a lookup of the ftable number via:

StabName = p4
chnget(p4)



On Sun, Mar 24, 2019 at 9:39 PM Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Hi Csounders,
Is it possible to pass an ftables variable name string via the score as a p value and somehow use that string usefully on the other side to name the ftable variable and store it's value? 

I have a situation on which passing the ftable f value via the score will be an absolute nightmare (at best) that will be incredible hard to debug... I can explain why if need be but the explanation will take some typing (I think?) and I wish to avoid throwing a long winded question at you guys if possible...

Pete
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

Date2019-03-30 23:11
FromPeter Burgess
SubjectRe: [Csnd] Passing ftable names via score
Thorin, the evalstr solution is ideal for my situation. Thank you

Pete
--
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

Date2019-03-31 02:07
FromSteven Yi
SubjectRe: [Csnd] Passing ftable names via score
Interesting, didn't realize evalstr was in the system though I knew about return. I had wanted to replace/alias xout with return in CS7 to look a little more familiar with other languages, especially with the new-style UDOs. Going to assume it's not going to be possible if it's getting used now. 

On Sat, Mar 30, 2019 at 7:11 PM Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Thorin, the evalstr solution is ideal for my situation. Thank you

Pete
--
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

Date2019-03-31 04:14
FromPeter Burgess
SubjectRe: [Csnd] Passing ftable names via score
Sorry, what do you mean? Are you saying stop using xout in favour of return? Or return in favour of xout? Either way, isn't part of the beauty of releasing a new major version the fact that it doesn't have to be entirely backwards compatible? If there's a way to remove excess keywords/opcodes that do similar or the same thing, then probably go for it and advise on the depreciation and replacement in the release notes and/or manual. That would be my thinking. CS6.latest will still exist for total backwards compatibility with CS6 :)

On Sun, Mar 31, 2019 at 2:08 AM Steven Yi <stevenyi@gmail.com> wrote:
Interesting, didn't realize evalstr was in the system though I knew about return. I had wanted to replace/alias xout with return in CS7 to look a little more familiar with other languages, especially with the new-style UDOs. Going to assume it's not going to be possible if it's getting used now. 

On Sat, Mar 30, 2019 at 7:11 PM Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Thorin, the evalstr solution is ideal for my situation. Thank you

Pete
--
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

Date2019-03-31 06:35
FromPete Goodeve
SubjectRe: [Csnd] Passing ftable names via score
AttachmentsNone  

Date2019-03-31 12:27
Fromthorin kerr
SubjectRe: [Csnd] Passing ftable names via score
Use it anyway? The manual entry for return suggests there's more functionality to be added (retrieving values from instruments). Might be nice if it was overloaded to become a 'use anywhere to retrieve anything' kind of opcode, including UDO's. Of course, I've no idea how possible/practical it would be to implement.

Thorin


On Sun, 31 Mar. 2019, 11:08 am Steven Yi, <stevenyi@gmail.com> wrote:
Interesting, didn't realize evalstr was in the system though I knew about return. I had wanted to replace/alias xout with return in CS7 to look a little more familiar with other languages, especially with the new-style UDOs. Going to assume it's not going to be possible if it's getting used now. 

On Sat, Mar 30, 2019 at 7:11 PM Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Thorin, the evalstr solution is ideal for my situation. Thank you

Pete
--
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