A structure for controlling modular processes.
env |
An overall amplitude envelope that synths created in a ProcMod function can access. This will run a .kr env on ProcMod.envbus that can be read by other synths in the ProcMod through the creation of a procmodenv synth. There is a max of 20 breakpoints to the env. If the Env has a releaseNode, ProcMod will continue to process events until .release is called. |
amp |
An overall amplitude control for an instance of ProcMod. |
id |
A \symbol or "string" to be used later to identify an instance of ProcMod. |
group |
A group for an instance of ProcMod to run in. Defaults to nil and a new group is created. If ProcMod creates the group, a new one is created on each .play call. |
addAction |
An addAction for this instance of ProcMod. Defaults to 0. |
target |
A target for this instance of ProcMod. Defaults to 1. |
function |
A Function, Task or Routine to be evaluated on the playing of this instance of ProcMod. If a Function is passed in that returns a Task or Routine, the ProcMod will become 're-triggerable' and will allow for overlapping getures (it can be released and restarted immediately). All Functions, when evaluated, will have the current group id and envbus passed in as an argument. |
releaseFunc |
A Function, Task or Routine to be evaluated after the ProcMod has finished its release. |
onReleaseFunc |
A Function, Task or Routine to be evaluated at release time. |
responder |
An instance of OSCresponder or OSCresponderNode for use by this instance of ProcMod. It is automatically added when the ProcMod starts, and released after the ProcMod finishes its release. |
timeScale |
Applies a scale function to the ProcMod envelope. Defaults to 1. |
lag |
Applies to chages to the amp value passed into this instance of ProcMod. |
clock |
An intance of Clock to run this instance of ProcMod. Defaults to SystemClock. |
server |
an instance of Server to run this ProcMod on. Useful for remote servers. Defaults to Server.default. |
Return the current control bus id the global envelope is written to for this instance of ProcMod.
aboutString |
Avaluates this instance of ProcMod. ProcMod.function is evaluated, and ProcMod.responder is set up if they are declared.
Same as .play.
recpath | |
timestamp | |
headerFormat | |
sampleFormat |
bounds | |
upperLevel | |
lowerLevel | |
parent | |
trig | |
showMeters |
oldproc |
An instance of Function, Task or Routine to be evaluated on ProcMod.play. If a Function is passed in, the ProcMod will become 're-triggerable' and can be restarted after it has been released. If a Function is passed in, it may return a Task or Routine. The function is passed the ProcMod's current group and envbus as args.
Aeleases an instance of ProcMod. If ProcMod.env has a release section, functions and OSCresponders wait until this has executed before releasing the ProcMods functionality.
reltime |
An instance of OSCresponder or OSCresponderNode for use by an instance of ProcMod.
aResponder |
OSCresponder. |
newtimeScale |
control | |
maxamp | |
minamp | |
clientPort | |
midiChannel |
An instance of Function, Task or Routine to be evaluated after a ProcMod has released.
newaddAction |
Return the current group of this instance of ProcMod.
Immediately free the ProcMod, regardless of ProcMod.env.
oldproc | |
oldresp | |
oldgroup | |
oldrelfunc | |
oldclock | |
oldhdr | |
oldroute | |
oldccctrl |
newTempo |
argClock | |
argServer | |
argEnv | |
argNumChannels | |
argProcout |
If there is an envelope controlling the overall amplitude of events, set the lag time for changes of amplitude to take effect (with the amp_ instance method).
newlag |
An instance of Env to be sent to the synthdef controlling an instance of ProcMods overall amplitude and event control. If a Number is passed in, it will represent a releasetime for the ProcMod.
newenv |
newtarget |
An instance of Function, Task or Routine to be evaluated the moment a ProcMod is released.
If there is an envelope controlling the overall amplitude of events, set the amplitude to val.
newamp | |
sendMidi |
places the Association into a Dictionary for later access. Any Association may be stored.
anAssociation |
SynthDef(\singrain, {arg freq, amp, dur, envbus; OffsetOut.ar(0, Pan2.ar( SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.sine(dur, amp), doneAction: 2) * In.kr(envbus), Rand.new(-1.0, 1.0) ) ) // read off the overall env control of the ProcMod }).add; // create a new proc mod, and assign a function to it a = ProcMod.new(Env([0, 1, 0], [1, 1], \sin, 1), server: s); a.function_({arg group, envbus, server; Task({ inf.do({ // start a new synth... run it inside this ProcMod's group, // and read control values off the envbus server.sendMsg(\s_new, \singrain, server.nextNodeID, 0, group, \freq, 440.rrand(1760), \amp, 0.1, \dur, 5, \envbus, envbus); 0.5.wait; }) }); }); // play it a.play; // change the amp a.amp_(2); // change the lag a.lag_(0.5); // change the amp again a.amp_(5); // release it a.release; // creating ProcMods in a functional way a = {arg amp, env, high, low, winsize, overlaps; var proc; // defaults to Server.default if no Server is supplied proc = ProcMod.new(env, amp); proc.function_({arg group, envbus, server; Task({ inf.do({ // start a new synth... run it inside this ProcMod's group, // and read control values off the envbus server.sendMsg(\s_new, \singrain, server.nextNodeID, 0, group, \freq, high.rrand(low), \amp, 1, \dur, winsize, \envbus, envbus); (winsize / overlaps).wait; }) }); }); }; // create new instances of ProcMod... store it to the variables 'b' and 'c' b = a.value(0.2, Env([0, 1, 0], [1, 1], \sin, 1), 2000, 1000, 0.1, 4); c = a.value(0.3, Env([0, 1, 0], [10, 0.1], [5, -10], 1), 440, 880, 0.4, 2); b.play; c.play; b.release; c.release;
Re-triggerable ProcMods
ProcMods are meant for the most part, to be played and released. However, if the function slot is passed a Function object, they can be re-triggered after they have been released. If the Function returns a Task or Routine, the ProcMod will function as though a Task or Routine were placed in the function slot (it will be started and released in the same way). Re-triggered events will be assigned a new group and envbus, so these are made available to the Function through arguments. If an OSCresponderNode or releaseFunc are needed for each re-triggered event, they should be assigned inside the Function:
SynthDef(\trig, {arg id, val; SendTrig.kr(Impulse.kr(10), id, val); }).add; SynthDef(\singrain, {arg freq, amp, dur, envbus; OffsetOut.ar(0, Pan2.ar( SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.sine(dur, amp), doneAction: 2) * In.kr(envbus), -1.0.rrand(1.0) ) ) // read off the overall env control of the ProcMod }).add; i = 0; s.boot; a = ProcMod.new(Env([0, 1, 0], [1, 3], \sin, 1), server: s); // use a function. This one returns the Task. group and envbus are passed in as args a.function_({arg group, envbus, server; a.responder_( OSCresponderNode(a.server.addr, '/tr', {arg time, resp, msg; (msg[2] == group).if({msg[3].postln}) }) ); Task({ s.sendMsg(\s_new, \trig, a.server.nextNodeID, 0, group, \id, group, \val, i); i = i + 1; inf.do({ // start a new synth... run it inside this ProcMod's group, // and read control values off the envbus server.sendMsg(\s_new, \singrain, server.nextNodeID, 0, group, \freq, 440.rrand(880) * i, \amp, 0.1, \dur, 5, \envbus, envbus); 0.05.wait; }); }); }); a.play; // play the ProcMod // release the current event, and start a new one immediately. These will overlap. a.release; a.play; // watch the posted values from the OSCresponderNode a.release;