Cycle {
// play a sequence of events in a cycle
*ar { arg list, numChannels =
1, nextTime = 1.0, maxRepeats = 1,
mul = 1.0, add = 0.0;
maxRepeats = if (maxRepeats.notNil, { maxRepeats * list.size
},{ nil });
^Spawn.ar(
{ arg spawn, eventCount,
synth;
list.wrapAt(eventCount).spawn(spawn, eventCount,
synth);
},
numChannels, nextTime, maxRepeats, mul, add
)
}
}
RandomEvent {
*ar { arg list, numChannels =
1, nextTime = 1.0, maxRepeats,
mul = 1.0, add = 0.0;
^Spawn.ar(
{ arg spawn, eventCount,
synth;
list.choose.spawn(spawn, eventCount, synth);
},
numChannels, nextTime, maxRepeats, mul, add
)
}
}
SelectEvent {
*ar { arg list, selectFunc, numChannels
= 1, nextTime = 1.0, maxRepeats,
mul = 1.0, add = 0.0;
^Spawn.ar(
{ arg spawn, eventCount,
synth;
list.wrapAt(
selectFunc.value(spawn, eventCount, synth).asInteger
).spawn(spawn, eventCount, synth);
},
numChannels, nextTime, maxRepeats, mul, add
)
}
}
//StreamPlayer {
// *ar { arg stream, numChannels = 1,
nextTime = 1.0, maxRepeats,
// mul = 1.0, add = 0.0;
// ^Spawn.ar(
// { arg spawn, eventCount,
synth;
// var func, dur, list;
// list = stream.next;
// if (list.notNil,
{
// #func, dur
= list;
// spawn.nextTime
= dur;
// func.spawn(spawn,
eventCount, synth);
// },{
// nil
// });
// },
// numChannels, nextTime,
maxRepeats, mul, add
// )
// }
//}
OrcScore {
// orchestra is an array (or dictionary)
of instrument functions.
// score is an array of arrays of parameters
to be passed to the instrument function.
*ar { arg orchestra, score, numChannels
= 1, nextTime = 1.0, maxRepeats = 1,
mul = 1.0, add = 0.0;
maxRepeats = if (maxRepeats.notNil, { maxRepeats * score.size
},{ nil });
^Spawn.ar(
{ arg spawn, eventCount,
synth;
var pfields,
instrument;
pfields = score.wrapAt(eventCount);
spawn.nextTime = pfields.at(0); // pfield zero must be delta time
instrument = orchestra.at(pfields.at(1));
// pfield one must be instrument index
instrument.spawn(spawn, eventCount, synth, pfields);
// call instrument function
},
numChannels, nextTime, maxRepeats, mul, add
)
}
}
OrcStream {
// orchestra is an array (or dictionary)
of instrument functions.
// stream is an object that returns
an array of parameters to be passed
// to the instrument function in response
to the 'next' message.
*ar { arg orchestra, score, numChannels
= 1, nextTime = 1.0,
mul = 1.0, add = 0.0;
^Spawn.ar(
{ arg spawn, eventCount,
synth;
var pfields,
instrument;
pfields = score.next;
if (pfields.notNil, {
spawn.nextTime = pfields.at(0); // pfield zero must be delta time
instrument = orchestra.at(pfields.at(1));
// pfield one must be instrument index
instrument.spawn(spawn, eventCount, synth,
pfields); // call instrument function
});
},
numChannels, nextTime, nil,
mul, add
)
}
}
/*
OrcEnvirs {
// score is an array of Environments.
*ar { arg score, numChannels = 1, nextTime
= 1.0, maxRepeats = 1,
mul = 1.0, add = 0.0;
^Spawn.ar(
{ arg spawn, eventCount,
synth;
var envir;
envir = score.wrapAt(eventCount);
envir.spawn(spawn,
eventCount, synth);
envir.push({
var dur;
spawn.nextTime
= ~deltaTime;
dur = ~dur; //
evaluate the duration
if (dur <
0, { // if negative then this is rest
spawn.logicalDur
= dur.neg;
nil //
return nil
},{
spawn.logicalDur
= dur.neg;
~voice.spawn(spawn,
eventCount, synth, dur); // build and return ugen graph
});
})
},
numChannels, nextTime, maxRepeats
* list.size, mul, add
)
}
}
*/
This page was created by SimpleText2Html 1.0.3 on 22-Feb-100.