[Csnd] Passing ftable names via score

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] Passing ftable names via score

iron_attorney
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Passing ftable names via score

Steven Yi
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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Passing ftable names via score

iron_attorney
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, <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Passing ftable names via score

iron_attorney
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, <[hidden email]> 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, <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Passing ftable names via score

thorin kerr
In reply to this post by Steven Yi
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, <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Passing ftable names via score

iron_attorney
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, <[hidden email]> 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, <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Passing ftable names via score

iron_attorney
Thorin, the evalstr solution is ideal for my situation. Thank you

Pete
--
Csound mailing list [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Passing ftable names via score

Steven Yi
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 <[hidden email]> wrote:
Thorin, the evalstr solution is ideal for my situation. Thank you

Pete
--
Csound mailing list [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Passing ftable names via score

iron_attorney
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 <[hidden email]> 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 <[hidden email]> wrote:
Thorin, the evalstr solution is ideal for my situation. Thank you

Pete
--
Csound mailing list [hidden email] 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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Passing ftable names via score

Pete G.
On Sun, Mar 31, 2019 at 04:14:37AM +0100, Peter Burgess wrote:
> 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 :)
>
Umm... (:-/)  Quoting from the front page of csound.com:

"One of the main principles in Csound development is to guarantee backwards compatibility. You can still render a Csound source file from 1986 on the latest Csound release, and you should be able to render a file written today with the latest Csound in 2036."

In fact, I was severely annoyed last week, by the change to GEN01
parameters.  I have yet to have anybody point me to the logic that
spurred it...

        -- Pete --

Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Passing ftable names via score

thorin kerr
In reply to this post by Steven Yi
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, <[hidden email]> 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 <[hidden email]> wrote:
Thorin, the evalstr solution is ideal for my situation. Thank you

Pete
--
Csound mailing list [hidden email] 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 [hidden email] 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 [hidden email] 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