PHSparUse (PHelpSynthParUse) defines Pbind(s) for using synth values of a HSpar
Part of: miSCellaneous
Inherits from: PHSuse (PHelpSynthUse)
Defines Pbind(s) which, when played, can use values of synths derived from PHSpar's synth definitions. Playing a PHSparUse is just an option for using an already playing help synth of a HSpar, which requires PHSpar first. See Working with HS and HSpar, paragraph "Working Scheme".
See also: Working with HS and HSpar, HSpar, PHSpar, PHSparPlayer, PHSusePlayer
Some Important Issues
Creation / Class Methods
*new (helpSynth, pbindArgs, hsIndices)
Creates a new PHSparUse object.
helpSynth - A HSpar object.
pbindArgs - Collection of the form [ dur1, pbindData1, ... , durN, pbindDataN ] , with
dur i - Duration value or pattern / stream of durations for corresponding Pbind(s).
pbindData i - A collection of Pbind pairs or a collection of Pbind pair collections,
defining possibly several Pbinds with same event timing.
hsIndices - Per default values are taken from the currently switched help synth.
Explicitely given hsIndices allow reference to values of other help synths from the corresponding Pbind(s).
Expects a collection of valid hsIndex values resp. patterns / streams of valid hsIndex values.
A valid hsIndex value is a valid help synth index or a collection of valid help synth indices.
Status control
play(clock, quant)
A PHSusePlayer object is instantiated and started using the TempoClock clock.
The Quant object quant lets the player step into the quantization as soon as possible,
with respect to the necessary latency. The PHSusePlayer can be stopped and resumed with options.
Examples
(
s = Server.local;
s.boot;
)
// HSpar with two synth definitions
(
h = HSpar(s, [ { |freq = 1, dev = 10, center = 80|
LFDNoise3.kr(freq, dev, center) },
{ |freq = 0.5, dev = 5, center = 60, addFreq = 0.1, addDev = 5|
LFDNoise3.kr(freq, dev, center) + SinOsc.kr(addFreq, 0, addDev) }
]);
c = TempoClock(1);
q = Quant(0.12);
)
// Play Pbind (via PHSpar) to poll values from one or both synths, according to the pattern given to hsIndices.
// Random add with adverb "+.x" adds an interval also to each of two simultaneous synth values.
(
x = PHSpar(h,
pbindArgs: [0.12, [\midinote, Pkey(\theseVals).collect(_ +.x [7, 8, [0,7], [-1,8]].choose),
\legato, 0.2, \amp, 0.05 ]],
hsIndices: [ Prand([0,1,\all], inf)]
).play(c,q);
)
// "stepping in" with second player at (with respect to latency) next possible time on grid
(
y = PHSparUse(h,
pbindArgs: [ Prand([0.36, 0.48],inf),
[\midinote, Pkey(\theseVals) + [1, 1.75, 2.5, 3.25, 4, 4.75, 5.5, 6.25],
\legato, 0.2, \amp, Prand([0.03, 0.05, 0.07], inf) ]],
hsIndices: [ Pn(Pshuf([0,0,1,1],1), inf) ]
).play(c,q);
)
// stop x, help synths still playing, producing values for y
x.stop;
// resume x
x.play(c,q);
// freeing the PHSplayer also stops all "related" PHSusePlayers and frees the HS
x.free;
/////////////////////////////////////////////////////////////////////////////////
// Instead of using PHSuse / PHSparUse objects in order to have seperate players
// it's, of course, also possible to define several HS / HSpar objects independently.
// As before players can be synced by Quants.
(
h = HSpar(s, [
{ |freq = 0.5, dev = 5, center = 70|
LFDNoise3.kr(freq, dev, center) },
{ |freq = 0.2, dev = 5, center = 62, addFreq = 0.1, addDev = 2|
LFTri.kr(freq, 0, dev, center) + SinOsc.kr(addFreq, 0, addDev) }
]);
c = TempoClock.new;
q = Quant(0.24, 0);
)
// first player using a HSpar
(
x = PHSpar(h,
pbindArgs: [
Pstutter(Pwhite(5,10), Pseq([0.12, 0.16], inf)),
[\midinote, Pkey(\thisVal) + Pseq([[2, 5], [1, 6], [0, 7]], inf), \legato, 0.2, \amp, 0.07],
0.24, [\midinote, Pkey(\thisVal) + [-6, -1, 3], \legato, 0.2, \amp, 0.07]],
hsIndices: [0, 1]
).play(c,q);
)
// define an additional HS
(
k = HS(s, {|start = 90, end = 50, dur = 10| XLine.kr(start, end, dur); });
)
// start synced player
(
r = PHS(k,
[\start, { rrand(85, 100) }],
0.12, [\midinote, Pkey(\val) + [0, 3.5], \legato, 0.2, \amp, 0.07]
);
y = r.play(c,q);
)
// stop and free (reset) second player and HS
y.free;
// play again - a new help synth is started
y.play(c,q);
// stop and free first player and HSpar
x.free;
// stop and free second one and HS
y.free;