Csound Csound-dev Csound-tekno Search About

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

Date2018-07-07 00:07
FromOscar Pablo Di Liscia
Subject[Csnd] how to know the rate of an input variable from within a Csound UDO
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 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

Date2018-07-07 02:11
Fromthorin kerr
SubjectRe: [Csnd] how to know the rate of an input variable from within a Csound UDO
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, <oscarpablodiliscia@gmail.com> 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 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

Date2018-07-07 02:23
Fromthorin kerr
SubjectRe: [Csnd] how to know the rate of an input variable from within a Csound UDO
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, <thorin.kerr@gmail.com> 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, <oscarpablodiliscia@gmail.com> 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 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

Date2018-07-07 12:23
FromVictor Lazzarini
SubjectRe: [Csnd] how to know the rate of an input variable from within a Csound UDO
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 <oscarpablodiliscia@GMAIL.COM> 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 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

Date2018-07-07 16:10
FromOscar Pablo Di Liscia
SubjectRe: [Csnd] how to know the rate of an input variable from within a Csound UDO
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 <Victor.Lazzarini@mu.ie> 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 <oscarpablodiliscia@GMAIL.COM> 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 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


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

Date2018-07-07 16:12
FromOscar Pablo Di Liscia
SubjectRe: [Csnd] how to know the rate of an input variable from within a Csound UDO
Many thanks for these hints also, Thorin.
Best

El viernes, 6 de julio de 2018, thorin kerr <thorin.kerr@gmail.com> 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, <thorin.kerr@gmail.com> 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, <oscarpablodiliscia@gmail.com> 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 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


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

Date2018-07-07 16:59
FromVictor Lazzarini
SubjectRe: [Csnd] how to know the rate of an input variable from within a Csound UDO
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 <oscarpablodiliscia@GMAIL.COM> wrote:

Many thanks for these hints also, Thorin.
Best

El viernes, 6 de julio de 2018, thorin kerr <thorin.kerr@gmail.com> 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, <thorin.kerr@gmail.com> 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, <oscarpablodiliscia@gmail.com> 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 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


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