PFSCHED

Dynamically schedule pfield controls.

in RTcmix/insts/bgg


quick syntax:

PFSCHED(outsk, dur, pfield_bus, pfield[, deleteflag])

Param Field Parameter Units Dynamic Optional Notes
p0 output start time seconds no no  
p1 duration seconds no no  
p2 pfield bus number to use - no no  
p3 pfield variable - no no  
p4 delete note flag keep note active: 0, delete note: 1 no yes default: 0

Author Brad Garton, 11/2009


PFSCHED allows you to schedule pfield control information dynamically as a note is executing.

Usage Notes

The PFSCHED instrument takes advantage of the pfield-enabled control capabilities of RTcmix instruments to arbitrarily schedule pfield controls during execution of a note. It uses an internal set of “pfield busses” (up to 1024) for the routing of pfield information to instruments/notes. This is useful in interactive RTcmix applications such as the rtcmix~ Max/MSP object or the iRTcmix library for iOS.

The “pfield bus” (or “pfbus”) is set up using the makeconnection(“pfbus”)… scorefile command. Once a pfield variable is created using this makeconnection(), it can be used to send other pfield control data through the “pfbus” associated with the makeconnection() pfield variable.

Here’s how it works in practice: Suppose you want to start a WAVETABLE note with an arbitrary duration, but at some point in the future you want to fade that note down (and possibly end it).

Any pfield may be scheduled using PFSCHED, including pfield variables associated with active pfield generators such as makeLFO and makerandom

One feature of the maketable(“line”,…) scorefile command that is very useful in conjunction with PFSCHED is the use of the “curval” token with the “dynamic” optional specifier:

   fadenv = maketable("line", "dynamic", 1000, 0,"curval", 1,0.0)

This will build the “line” maketable using the current value of a pfield associated with a “pfbus”. The table doesn’t actually get created until the PFSCHED instrument schedules the table for use. This allows it to check the current value of the pfield associated with a “pfbus” and use it to build the table. In other words, you can begin a fade (like the above example) using whatever value is set for an instrument/note when the pfield control is scheduled using PFSCHED

Sample Scores

very basic:

   rtsetparams(44100, 1)
   load("PFSCHED")
   load("WAVETABLE")

   value = makeconnection("pfbus", 1, 0.0)

   WAVETABLE(0, 77.0, 20000*value, 8.00)

   delayed_envelope = maketable("line", 100, 0,0.0,  1,1.0)
   PFSCHED(2.5, 2.1, 1, delayed_envelope)

slightly more advanced:

   rtsetparams(44100, 1)
   load("PFSCHED")
   load("WAVETABLE")

   reset(10000)

   fadeup_envelope = maketable("line", 1000, 0,0.0,  1,1.0)
   controlpfield = makeconnection("pfbus", 1, 0.0)

   PFSCHED(4.5, 0.01, 1, fadeup_envelope)

   WAVETABLE(0, 777.0, 20000*controlpfield, 8.00)

   fadedown_envelope = maketable("line", "dynamic", 1000, 0,"curval",  1,0.0)
   //note that deleteflag is set; the note will be deleted when fadedown_envelope finishes
   PFSCHED(6.2, 1.5, 1, fadedown_envelope, 1)

fun stuff!

   rtsetparams(44100, 2)
   load("PFSCHED")
   load("WAVETABLE")

   delayed_envelope = maketable("line", 1000, 0,0.0,  1,1.0)
   ampvalue1 = makeconnection("pfbus", 1, 0.0)
   ampvalue2 = makeconnection("pfbus", 2, 1.0)
   PFSCHED(0.5, 3.5, 1, delayed_envelope)

   delayed_LFO = makeLFO("sine", 5.0, 0, 0.03)
   pitchvalue = makeconnection("pfbus", 3, 0.0)
   PFSCHED(4.0, 3.5, 3, delayed_LFO)

   wave = maketable("wave", 1000, "saw9")

   WAVETABLE(0, 777.0, 20000*ampvalue1*ampvalue2, 8.00+pitchvalue, 0.5, wave)

   fade_env =  maketable("line", 1000, 0,1.0,  1,0.0)
   PFSCHED(5.2, 1.4, 2, fade_env, 1)

See Also

makeconnection, maketable, makeLFO, WAVETABLE