| With regard to Gab's statement that schedkwhen is broken when fractional
instrument numbers are used (held) - see his original post below, I don't
seem to find this to be true - either in CsoundAV or CS5. I've set up a
simple test in the attached file.
Re the test: Clicking the checkbox instigates a slow arpeggiated A major
triad ascending. Unchecking the box takes the notes out in reverse order -
which is what is supposed to happen. All four fractional tied notes are
identified correctly prior to cutoff.
I've also constructed the file with Gab's schedk alternative. This works
similarly (correctly) in CsoundAV, but of course bombs in CS5.
I'd like to renew my call for schedk's inclusion in CS5.
Did anyone, perchance, *fix* schedkwhen - or was it really handling
fractional instruments right all along?
Or is my test not adequate? Gab? Michael?
Art Hunkins
----- Original Message -----
From: "Art Hunkins"
To: ;
Sent: Saturday, July 24, 2004 4:24 PM
Subject: Re: [Csnd] Schedwhen v schedkwhen
> Two suggestions:
>
> 1) Assuming that schedwhen is being abandoned since it doesn't work, I
hope
> that Gab's schedk - the functional equivalent of schedwhen, can be added
to
> CS5. (Some of us like the trigger mechanism.)
>
> 2) Since fractional parts of instrument numbers are very important for
> anyone using multiple instances of the same instrument independently, I
hope
> that schedkwhen can be fixed to work with these fractions correctly. (See
> Gab's critique below.) Though I've not personally run into this
limitation,
> it is potentially a serious one.
>
> One question:
>
> Both Gab (in schedk) and Matt (in event - otherwise comparable to
schedule,
> which also works) allow for scheduling other score operators than i -
> especially f. Matt refers to the potential of others as well(??)
>
> Who has ever scheduled any score event other than a note event, even a
> function table (f)? Is there a need for such scheduling?
>
> If not, it would certainly be simpler (both in schedk and event) to
*assume*
> an i operator, and just straight indicate the instrument number - saving a
> variable (either a string in quotes for event; or an ascii equivalent for
> schedk). Both represent somewhat of a hassle and potential error - *if
> there's no good reason for it*.
>
> Art Hunkins
>
> ----- Original Message -----
> From: "Gabriel Maldonado"
> To: ; "csound-dev"
> Sent: Saturday, July 24, 2004 9:42 AM
> Subject: Re: [Csnd] Schedwhen v schedkwhen
>
>
> > In CsoundAV, I'm using most often schedk, that is a simplification of
> > schedkwhen, easier to use (because takes less parameters). It also
> > allows to schedule held notes (negative p3) with fractional instrument
> > numbers, allowing polyphony by correctly turning off held notes with
> > negative fractional values of p1. BTW: Unfortunately, schedkwhen fails
> > when scheduling held notes having fractional instr numbers (because it
> > truncates the fractional part). Notice that also the infoff() function
> > contained in the file insert.c has to be modified to allow fractional
> > instrument numbers to function correctly. Also the EVTNODE structure
> > (schedule.h) has been slightly modified. I also isolated a Sched()
> > function, that is useful not only for schedk, but also for other
> > scheduling opcodes.
> >
> > this is the manual of schedk:
> > ////////////// MANUAL ///////////////////
> >
> > schedk ktrigger, kopcode, kp1 [,kp2 ,kp3, kp4, kp5, kp6, ...., kpN]
> >
> >
> > Generate events from orchestra at k-rate. This opcode may be useful eg
> > for certain kinds of algorithmic composition.
> >
> > NOTE: These opcodes are not included (yet?) in the standard Bath Csound
> > distribution. See CsoundAV.
> >
> > PERFORMANCE
> >
> > ktrigger - trigger signal (see trigger and metro opcodes).
> > kopcode - ascii code of the corresponding score opcode to be activated
> > (for example, for the notes of score the ascii code of 'i' i.e. 105).
> > Zero is the default and is equivalent to 'i' opcode, so you can use 0 or
> > 105 obtaining the same result.
> > kp1,kp2,..., kpN - p-fields passed to generated events.
> >
> > schedk is derived from schedkwhen, but is simpler to use because it has
> > less arguments, is more specialized, and slightly faster. In fact it
> > doesn't support the schedkwhen arguments kmintime, kmaxinst, kinsnum
> > etc. In the future it will also allow score opcodes different from 'i'.
> > At present time only the 'i' opcode is supported (because I haven't
> > tested the other score opcodes yet).
> >
> >
> > ///////// entry.c //////////////
> >
> > { "schedk", S(SCHEDK),3, "", "kkz",schedk_i, schedk, NULL },
> >
> > //////// schedk.h /////////////
> >
> > typedef struct {
> > OPDS h;
> > MYFLT *trigger;
> > MYFLT *args[PMAX+1];
> > } SCHEDK;
> >
> > /////// schedk.c ///////////////
> >
> > void Sched(MYFLT *args[], int numargs) {
> > int i, argnum;
> > MYFLT insno, starttime, absinsno;
> > EVTNODE *evtlist, *newnode;
> > EVTBLK *newevt;
> >
> > /* Get absolute instr num */
> > insno = *args[1];
> > absinsno = (insno >=0) ? insno : -insno; //gab
> > /* Create the new event */
> > newnode = (EVTNODE *) mmalloc((long)sizeof(EVTNODE));
> > newevt = &newnode->evt;
> > newevt->opcod = (char) *args[0];
> > if (newevt->opcod == 0) newevt->opcod = 'i';
> > /* Set start time from kwhen */
> > starttime = *args[2];
> > if(starttime < FZERO) {
> > starttime = FZERO;
> > }
> > /* Add current time (see note about kadjust in triginset() above) */
> > starttime += (MYFLT)(kcounter-1L) * onedkr;
> > newnode->kstart = (long)(starttime * ekr + 0.5f);
> > newevt->p2orig = starttime;
> > newevt->p3orig = *args[3];
> > /* Copy all arguments to the new event */
> > newevt->pcnt = (argnum = numargs) -1;
> > for(i = 1; i < argnum; i++)
> > newevt->p[i] = *args[i];
> > newevt->p[2] = starttime; /* Set actual start time in p2 */
> >
> > newnode->insno = absinsno;
> > /* Set event activation time in k-cycles */
> > newnode->kstart = (long)(starttime * ekr + 0.5f);
> >
> > /* Insert eventnode in list of generated events */
> > evtlist = &OrcTrigEvts;
> > while (evtlist->nxtevt) {
> > if(newnode->kstart < evtlist->nxtevt->kstart) break;
> > evtlist = evtlist->nxtevt;
> > }
> > newnode->nxtevt = evtlist->nxtevt;
> > evtlist->nxtevt = newnode;
> > O.RTevents = 1; /* Make sure kperf() looks for RT events */
> > O.ksensing = 1;
> > O.OrcEvts = 1; /* - of the appropriate type */
> > }
> >
> >
> > void schedk(SCHEDK *p);
> >
> > void schedk_i(SCHEDK *p) { /* based on code by rasmus */
> > O.RTevents = 1; /* Make sure kperf() looks for RT events */
> > O.ksensing = 1;
> > O.OrcEvts = 1; /* - of the appropriate type */
> > if (kcounter > 0 && *p->trigger != FZERO && p->h.insdshead->p3
==
> 0)
> > schedk(p);
> > }
> >
> > void schedk(SCHEDK *p) { /* based on code by rasmus */
> > if (*p->trigger) /* Only do something if triggered */
> > Sched(p->args, p->INOCOUNT-1);
> > }
> >
> > ////////// insert.c //////////////
> > /* modified version of infoff() */
> >
> > void infoff(MYFLT p1) /* turn off an indef copy of instr p1 */
> > { /* called by musmon */
> > INSDS *ip;
> > int insno;
> >
> > insno = (int)p1;
> > if ((ip = (instrtxtp[(int) insno])->instance) != NULL) {
> > do {
> > if (ip->insno == insno /* if find the insno */
> > && ip->actflg /* active
*/
> > && ip->offtim < 0 /* but indef,
*/
> > && ip->p1 == p1) {
> >
> > if (ip->xtratim && ip->offbet < 0) { /* Gab: delays
> > the off event if xtratim > 0 */
> > #include "schedule.h"
> > MYFLT starttime;
> > EVTNODE *evtlist, *newnode;
> > EVTBLK *newevt;
> >
> > newnode = (EVTNODE *)
> > mmalloc((long)sizeof(EVTNODE));
> > newevt = &newnode->evt;
> > newevt->opcod = 'i';
> > starttime = (MYFLT) (kcounter + ip->xtratim) *
> > onedkr;
> > newnode->kstart = kcounter + ip->xtratim;
> > newevt->p2orig = starttime;
> > newevt->p3orig = FL(0.0);
> > newevt->p[1] = -p1; //gab /* negative p1 */
> > newevt->p[2] = starttime; /* Set actual start
> > time in p2 */
> > newevt->p[3] = FL(0.0);
> > newevt->pcnt = 2;
> > newnode->insno = insno;
> > evtlist = &OrcTrigEvts;
> > while (evtlist->nxtevt) {
> > if(newnode->kstart <
evtlist->nxtevt->kstart)
> > break;
> > evtlist = evtlist->nxtevt;
> > }
> > newnode->nxtevt = evtlist->nxtevt;
> > evtlist->nxtevt = newnode;
> > O.RTevents = 1; /* Make sure kperf() looks
for
> > RT events */
> > O.ksensing = 1;
> > O.OrcEvts = 1;
> >
> > ip->offbet = 0; /* to avoid another check */
> > ip->relesing = 1;
> > return;
> > }
> > VMSG(printf("turning off inf copy of instr
> > %d\n",insno);)
> > deact(ip);
> > return; /* turn it off */
> > }
> > } while ((ip = ip->nxtinstance) != NULL);
> > }
> > printf(Str(X_669,"could not find indefinitely playing instr
> > %d\n"),insno);
> > }
> > ////////////// schedule.h ///////////
> >
> > typedef struct eventnode {
> > EVTBLK evt; /* Must be first in struct so it can be typecast & freed */
> > struct eventnode *nxtevt;
> > int kstart;
> > MYFLT insno; /* gab */
> > } EVTNODE;
> >
> >
> > ///////////////////////////////////////////////////////////
> > jpff@codemist.co.uk wrote:
> > > Is anyone actually using schedwhen? It seems to be subsumed into
> > > schedkwhen (and that opcode actually works!) so there is a proposal
> to
> > > remove schedwhen from csound5. Any comments to me of developer
list
> > > ==John ffitch
> >
> >
> > --
> > Gabriel Maldonado
> > http://csounds.com/maldonado
> > --
> >
> >
> > --
> > Send bugs reports to csound-bugs@cs.bath.ac.uk
> > (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
> > To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>
|