[Csnd] how to know the rate of an input variable from within a Csound UDO

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

[Csnd] how to know the rate of an input variable from within a Csound UDO

Oscar Pablo Di Liscia
Dear list:
I'm probably asking something stupid, but is there a way to know the rate of
an input variable from within a Csound UDO?
This is asked in order to improve the performance of an opcode without doing an i-rate version of it.
I mean:

opcode anything, a, ak

    aIn, aOut, kParam xin

  ;try to find whether kParam is an k or i rate variable
   if(kParam is an i-rate variable)  then
    ("do something")
   else
     ("do a different thing")
   endif

   xout aOut

endop


Thanks in advance.

Dr. Oscar Pablo Di Liscia
Profesor Titular
Director Programa de Investigación "Sistemas Temporales y Síntesis Espacial de Sonido en el Arte Sonoro"
Escuela Universitaria de Artes
Universidad Nacional de Quilmes
Argentina
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] how to know the rate of an input variable from within a Csound UDO

thorin kerr
Not a great solution, but a krate input will always be 0 at init time, whereas an irate input will keep its value. 

Thorin

On Sat, 7 Jul. 2018, 9:08 am Oscar Pablo Di Liscia, <[hidden email]> wrote:
Dear list:
I'm probably asking something stupid, but is there a way to know the rate of
an input variable from within a Csound UDO?
This is asked in order to improve the performance of an opcode without doing an i-rate version of it.
I mean:

opcode anything, a, ak

    aIn, aOut, kParam xin

  ;try to find whether kParam is an k or i rate variable
   if(kParam is an i-rate variable)  then
    ("do something")
   else
     ("do a different thing")
   endif

   xout aOut

endop


Thanks in advance.

Dr. Oscar Pablo Di Liscia
Profesor Titular
Director Programa de Investigación "Sistemas Temporales y Síntesis Espacial de Sonido en el Arte Sonoro"
Escuela Universitaria de Artes
Universidad Nacional de Quilmes
Argentina
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] how to know the rate of an input variable from within a Csound UDO

thorin kerr
Or... haven't checked this mind...
If you write two UDO's with the same name, except one with krate input, and the other with irate, then Csound will choose the UDO based on the input. I think.

T

On Sat, 7 Jul. 2018, 11:11 am thorin kerr, <[hidden email]> wrote:
Not a great solution, but a krate input will always be 0 at init time, whereas an irate input will keep its value. 

Thorin

On Sat, 7 Jul. 2018, 9:08 am Oscar Pablo Di Liscia, <[hidden email]> wrote:
Dear list:
I'm probably asking something stupid, but is there a way to know the rate of
an input variable from within a Csound UDO?
This is asked in order to improve the performance of an opcode without doing an i-rate version of it.
I mean:

opcode anything, a, ak

    aIn, aOut, kParam xin

  ;try to find whether kParam is an k or i rate variable
   if(kParam is an i-rate variable)  then
    ("do something")
   else
     ("do a different thing")
   endif

   xout aOut

endop


Thanks in advance.

Dr. Oscar Pablo Di Liscia
Profesor Titular
Director Programa de Investigación "Sistemas Temporales y Síntesis Espacial de Sonido en el Arte Sonoro"
Escuela Universitaria de Artes
Universidad Nacional de Quilmes
Argentina
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] how to know the rate of an input variable from within a Csound UDO

Victor Lazzarini-2
In reply to this post by Oscar Pablo Di Liscia
Hi Oscar,

this is not possible in the way you describe. Normally this is done by overloading the opcode (i.e. writing different versions for
different inputs, but using the same opcode name).

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 7 Jul 2018, at 00:08, Oscar Pablo Di Liscia <[hidden email]> wrote:

Dear list:
I'm probably asking something stupid, but is there a way to know the rate of
an input variable from within a Csound UDO?
This is asked in order to improve the performance of an opcode without doing an i-rate version of it.
I mean:

opcode anything, a, ak

    aIn, aOut, kParam xin

  ;try to find whether kParam is an k or i rate variable
   if(kParam is an i-rate variable)  then
    ("do something")
   else
     ("do a different thing")
   endif

   xout aOut

endop


Thanks in advance.

Dr. Oscar Pablo Di Liscia
Profesor Titular
Director Programa de Investigación "Sistemas Temporales y Síntesis Espacial de Sonido en el Arte Sonoro"
Escuela Universitaria de Artes
Universidad Nacional de Quilmes
Argentina
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] how to know the rate of an input variable from within a Csound UDO

Oscar Pablo Di Liscia
Many thanks Victor, that was my "b plan", i appreciate very much to know for sure that is
the right way.
Best

El sábado, 7 de julio de 2018, Victor Lazzarini <[hidden email]> escribió:
Hi Oscar,

this is not possible in the way you describe. Normally this is done by overloading the opcode (i.e. writing different versions for
different inputs, but using the same opcode name).

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 7 Jul 2018, at 00:08, Oscar Pablo Di Liscia <[hidden email]> wrote:

Dear list:
I'm probably asking something stupid, but is there a way to know the rate of
an input variable from within a Csound UDO?
This is asked in order to improve the performance of an opcode without doing an i-rate version of it.
I mean:

opcode anything, a, ak

    aIn, aOut, kParam xin

  ;try to find whether kParam is an k or i rate variable
   if(kParam is an i-rate variable)  then
    ("do something")
   else
     ("do a different thing")
   endif

   xout aOut

endop


Thanks in advance.

Dr. Oscar Pablo Di Liscia
Profesor Titular
Director Programa de Investigación "Sistemas Temporales y Síntesis Espacial de Sonido en el Arte Sonoro"
Escuela Universitaria de Artes
Universidad Nacional de Quilmes
Argentina
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


--
Dr. Oscar Pablo Di Liscia
Profesor Titular
Director Programa de Investigación "Sistemas Temporales y Síntesis Espacial de Sonido en el Arte Sonoro"
Escuela Universitaria de Artes
Universidad Nacional de Quilmes
Argentina

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] how to know the rate of an input variable from within a Csound UDO

Oscar Pablo Di Liscia
In reply to this post by thorin kerr
Many thanks for these hints also, Thorin.
Best

El viernes, 6 de julio de 2018, thorin kerr <[hidden email]> escribió:
Or... haven't checked this mind...
If you write two UDO's with the same name, except one with krate input, and the other with irate, then Csound will choose the UDO based on the input. I think.

T

On Sat, 7 Jul. 2018, 11:11 am thorin kerr, <[hidden email]> wrote:
Not a great solution, but a krate input will always be 0 at init time, whereas an irate input will keep its value. 

Thorin

On Sat, 7 Jul. 2018, 9:08 am Oscar Pablo Di Liscia, <[hidden email]> wrote:
Dear list:
I'm probably asking something stupid, but is there a way to know the rate of
an input variable from within a Csound UDO?
This is asked in order to improve the performance of an opcode without doing an i-rate version of it.
I mean:

opcode anything, a, ak

    aIn, aOut, kParam xin

  ;try to find whether kParam is an k or i rate variable
   if(kParam is an i-rate variable)  then
    ("do something")
   else
     ("do a different thing")
   endif

   xout aOut

endop


Thanks in advance.

Dr. Oscar Pablo Di Liscia
Profesor Titular
Director Programa de Investigación "Sistemas Temporales y Síntesis Espacial de Sonido en el Arte Sonoro"
Escuela Universitaria de Artes
Universidad Nacional de Quilmes
Argentina
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


--
Dr. Oscar Pablo Di Liscia
Profesor Titular
Director Programa de Investigación "Sistemas Temporales y Síntesis Espacial de Sonido en el Arte Sonoro"
Escuela Universitaria de Artes
Universidad Nacional de Quilmes
Argentina

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] how to know the rate of an input variable from within a Csound UDO

Victor Lazzarini-2
yes, that’s what I meant by ‘overloaded’.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 7 Jul 2018, at 16:12, Oscar Pablo Di Liscia <[hidden email]> wrote:

Many thanks for these hints also, Thorin.
Best

El viernes, 6 de julio de 2018, thorin kerr <[hidden email]> escribió:
Or... haven't checked this mind...
If you write two UDO's with the same name, except one with krate input, and the other with irate, then Csound will choose the UDO based on the input. I think.

T

On Sat, 7 Jul. 2018, 11:11 am thorin kerr, <[hidden email]> wrote:
Not a great solution, but a krate input will always be 0 at init time, whereas an irate input will keep its value. 

Thorin

On Sat, 7 Jul. 2018, 9:08 am Oscar Pablo Di Liscia, <[hidden email]> wrote:
Dear list:
I'm probably asking something stupid, but is there a way to know the rate of
an input variable from within a Csound UDO?
This is asked in order to improve the performance of an opcode without doing an i-rate version of it.
I mean:

opcode anything, a, ak

    aIn, aOut, kParam xin

  ;try to find whether kParam is an k or i rate variable
   if(kParam is an i-rate variable)  then
    ("do something")
   else
     ("do a different thing")
   endif

   xout aOut

endop


Thanks in advance.

Dr. Oscar Pablo Di Liscia
Profesor Titular
Director Programa de Investigación "Sistemas Temporales y Síntesis Espacial de Sonido en el Arte Sonoro"
Escuela Universitaria de Artes
Universidad Nacional de Quilmes
Argentina
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


--
Dr. Oscar Pablo Di Liscia
Profesor Titular
Director Programa de Investigación "Sistemas Temporales y Síntesis Espacial de Sonido en el Arte Sonoro"
Escuela Universitaria de Artes
Universidad Nacional de Quilmes
Argentina

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