Csound Csound-dev Csound-tekno Search About

[Csnd] schedule and UDOs

Date2020-01-08 21:42
FromPete Goodeve
Subject[Csnd] schedule and UDOs
AttachmentsNone  

Date2020-01-08 21:48
FromRory Walsh
SubjectRe: [Csnd] schedule and UDOs
schedule is i-rate, no amount of sweet talking is going to change that. It's kind of implied by the fact that it takes i-rate inputs, or so this my understanding of it. Try schedkwhen if you need a krate version

On Wed, 8 Jan 2020 at 21:42, Pete Goodeve <pete.goodeve@computer.org> wrote:
Hi,

I'm having some trouble in understanding what I'm
seeing in  my experimentation.  I hope someone can
clear it up.

I got Joachim's 'OnDtct.csd' to work nicely by substituting
an event statement for the 'schedulek', but I thought this
would be a good place to try a UDO (which I haven't played
with much) to implement the schedulek.

So I added this UDO:

opcode schedulek, 0, Skk
        Sname, istart, idur xin
        schedule Sname, istart, idur
endop

and called it with a slightly modified:

   schedulek "Play",0,1/10

However, "Play" only gets invoked once at the very beginning
of execution.  (I originally had "Sii" for the parameters, but I
thought that mght be causing the opcode to be i-time only.)

I assume, though I can't find it stated, that 'schedule' is an
i-time only opcode -- hence the need for 'schedulek' -- but
I thought that if I put it in an opcode it would get invoked
appropriately.

Where am I going wrong?

Thanks,

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

Date2020-01-08 22:33
FromPete Goodeve
SubjectRe: [Csnd] schedule and UDOs
AttachmentsNone  

Date2020-01-08 22:38
FromVictor Lazzarini
SubjectRe: [Csnd] schedule and UDOs
An UDO runs i-time code only once, unless there is a reinit. That's exactly what an opcode would do (and indeed an instrument).

Prof. Victor Lazzarini
Maynooth University
Ireland

> On 8 Jan 2020, at 22:34, Pete Goodeve  wrote:
> 
>> On Wed, Jan 08, 2020 at 09:48:31PM +0000, Rory Walsh wrote:
>> schedule is i-rate, no amount of sweet talking is going to change that.
>> It's kind of implied by the fact that it takes i-rate inputs, or so this my
>> understanding of it. Try schedkwhen if you need a krate version
> 
> I guess I'm misuderstanding the point of a UDO.  I thought it was
> essentially an instrument of its own, with an i-segment each time
> it was invoked.  This is not so?
> 
>    -- Pete --
> 
>> 
>>> On Wed, 8 Jan 2020 at 21:42, Pete Goodeve  wrote:
>>> 
>>> Hi,
>>> 
>>> I'm having some trouble in understanding what I'm
>>> seeing in  my experimentation.  I hope someone can
>>> clear it up.
>>> 
>>> I got Joachim's 'OnDtct.csd' to work nicely by substituting
>>> an event statement for the 'schedulek', but I thought this
>>> would be a good place to try a UDO (which I haven't played
>>> with much) to implement the schedulek.
>>> 
>>> So I added this UDO:
>>> 
>>> opcode schedulek, 0, Skk
>>>        Sname, istart, idur xin
>>>        schedule Sname, istart, idur
>>> endop
>>> 
>>> and called it with a slightly modified:
>>> 
>>>   schedulek "Play",0,1/10
>>> 
>>> However, "Play" only gets invoked once at the very beginning
>>> of execution.  (I originally had "Sii" for the parameters, but I
>>> thought that mght be causing the opcode to be i-time only.)
>>> 
>>> I assume, though I can't find it stated, that 'schedule' is an
>>> i-time only opcode -- hence the need for 'schedulek' -- but
>>> I thought that if I put it in an opcode it would get invoked
>>> appropriately.
>>> 
>>> Where am I going wrong?
>>> 
>>> Thanks,
>>> 
>>>        -- 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

Date2020-01-08 22:42
FromDave Seidel
SubjectRe: [Csnd] schedule and UDOs
It is only invoked from its parent instrument at i-time, so it will only get invoked once unless you use reinit. You can make k-rate UDOs as well (use k params and invoke like my_udo:k(params), but an opcode within the UDO still has the same characteristics it would have within an instrument.

On Wed, Jan 8, 2020 at 5:33 PM Pete Goodeve <pete.goodeve@computer.org> wrote:
On Wed, Jan 08, 2020 at 09:48:31PM +0000, Rory Walsh wrote:
> schedule is i-rate, no amount of sweet talking is going to change that.
> It's kind of implied by the fact that it takes i-rate inputs, or so this my
> understanding of it. Try schedkwhen if you need a krate version

I guess I'm misuderstanding the point of a UDO.  I thought it was
essentially an instrument of its own, with an i-segment each time
it was invoked.  This is not so?

        -- Pete --

>
> On Wed, 8 Jan 2020 at 21:42, Pete Goodeve <pete.goodeve@computer.org> wrote:
>
> > Hi,
> >
> > I'm having some trouble in understanding what I'm
> > seeing in  my experimentation.  I hope someone can
> > clear it up.
> >
> > I got Joachim's 'OnDtct.csd' to work nicely by substituting
> > an event statement for the 'schedulek', but I thought this
> > would be a good place to try a UDO (which I haven't played
> > with much) to implement the schedulek.
> >
> > So I added this UDO:
> >
> > opcode schedulek, 0, Skk
> >         Sname, istart, idur xin
> >         schedule Sname, istart, idur
> > endop
> >
> > and called it with a slightly modified:
> >
> >    schedulek "Play",0,1/10
> >
> > However, "Play" only gets invoked once at the very beginning
> > of execution.  (I originally had "Sii" for the parameters, but I
> > thought that mght be causing the opcode to be i-time only.)
> >
> > I assume, though I can't find it stated, that 'schedule' is an
> > i-time only opcode -- hence the need for 'schedulek' -- but
> > I thought that if I put it in an opcode it would get invoked
> > appropriately.
> >
> > Where am I going wrong?
> >
> > Thanks,
> >
> >         -- 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

Date2020-01-08 22:43
FromRory Walsh
SubjectRe: [Csnd] schedule and UDOs
UDOs can be any rate. If you only call i-time opcodes in a UDO, that UDO will only run at i-time. Rather than thinking of UDOs as instruments, just think of them as opcodes.

On Wed, 8 Jan 2020 at 22:34, Pete Goodeve <pete.goodeve@computer.org> wrote:
On Wed, Jan 08, 2020 at 09:48:31PM +0000, Rory Walsh wrote:
> schedule is i-rate, no amount of sweet talking is going to change that.
> It's kind of implied by the fact that it takes i-rate inputs, or so this my
> understanding of it. Try schedkwhen if you need a krate version

I guess I'm misuderstanding the point of a UDO.  I thought it was
essentially an instrument of its own, with an i-segment each time
it was invoked.  This is not so?

        -- Pete --

>
> On Wed, 8 Jan 2020 at 21:42, Pete Goodeve <pete.goodeve@computer.org> wrote:
>
> > Hi,
> >
> > I'm having some trouble in understanding what I'm
> > seeing in  my experimentation.  I hope someone can
> > clear it up.
> >
> > I got Joachim's 'OnDtct.csd' to work nicely by substituting
> > an event statement for the 'schedulek', but I thought this
> > would be a good place to try a UDO (which I haven't played
> > with much) to implement the schedulek.
> >
> > So I added this UDO:
> >
> > opcode schedulek, 0, Skk
> >         Sname, istart, idur xin
> >         schedule Sname, istart, idur
> > endop
> >
> > and called it with a slightly modified:
> >
> >    schedulek "Play",0,1/10
> >
> > However, "Play" only gets invoked once at the very beginning
> > of execution.  (I originally had "Sii" for the parameters, but I
> > thought that mght be causing the opcode to be i-time only.)
> >
> > I assume, though I can't find it stated, that 'schedule' is an
> > i-time only opcode -- hence the need for 'schedulek' -- but
> > I thought that if I put it in an opcode it would get invoked
> > appropriately.
> >
> > Where am I going wrong?
> >
> > Thanks,
> >
> >         -- 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

Date2020-01-08 23:33
FromPete Goodeve
SubjectRe: [Csnd] schedule and UDOs
AttachmentsNone  

Date2020-01-08 23:37
FromJohn ff
SubjectRe: [Csnd] schedule and UDOs
Or just wait for 6.14 which has schedulek as an opcode.


On 8 Jan 2020, at 23:34, Pete Goodeve <pete.goodeve@computer.org> wrote:
Thanks everybody for the illumination!

So I changed the UDO to:

opcode schedulek, 0, Skk
Sname, istart, idur xin
redo:
reinit redo
schedule Sname, istart, idur
rireturn
endop

and it worked as I'd initially expected.

Not quite sure abot the 'rireturn'. If I'd left it out
would the calling instrument also have entered
an init pass?

Thanks,

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

Date2020-01-08 23:56
FromPete Goodeve
SubjectRe: [Csnd] schedule and UDOs
AttachmentsNone