PHS (PHelpSynth) defines Pbind(s) for using synth values of a HS


Part of: miSCellaneous


Inherits from: PHSuse (PHelpSynthUse)


Defines Pbind(s) which, when played, can use values of a synth derived from HS's synth definition.


See also: Working with HS and HSpar, HS, PHSuse, PHSplayer, PHSusePlayer



Some Important Issues


See Working with HS and HSpar



Creation / Class Methods


*new (helpSynth, helpSynthArgs, dur1, pbindData1, ... , durN, pbindDataN)

Creates a new PHS object.

helpSynth - A HS object.

helpSynthArgs - Collection of key / value pairs for the HS synth.

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 the same event timing. 



Status control


play(clock, quant)

A PHSplayer 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 PHSplayer can be stopped and resumed with several options.



Examples



(

s = Server.local;

s.boot;

)



// define a HS with args


h = HS(s, { |freq = 0.5, dev = 10, center = 65| LFDNoise3.kr(freq, dev, center) });



// two Pbinds with different event timing reading from one help synth 

(

p = PHS(h, nil, // default help synth args

Prand([0.4, 0.2],inf), [ \midinote, Pkey(\val), \amp, 0.08  ],

0.1, [ \midinote, Pkey(\val) + 9.5 + Pxrand([0, 2, 5],inf), \amp, 0.06 ]

).play;

)


// stop player and free HS, ready to be played again with the same or another PHS

p.free;



// now with synth args

(

p = PHS(h, [\freq, 2, \dev, 20], // more oscillation

Prand([0.4, 0.2],inf), [ \midinote, Pkey(\val) - [0, 5, 10], \amp, 0.06 ],

0.1, [ \midinote, Pkey(\val) + 9.5 + Pxrand([0, 4, 7],inf), \amp, 0.06 ]

).play;

)



// stop player and free HS


p.free;




// let PHS define two Pbinds with same event timing, one mostly pausing


(

p = PHS(h, [], 0.16, 

[ [\midinote, Pkey(\val), \amp, 0.1], 

  [\midinote, Pkey(\val) + [-7, 4, 7],

\amp, Pwrand([0.04, 0.08], [0.8, 0.2], inf),

\type, Pkey(\val).collect { |x| x.asInteger.even.if { \note }{ \rest } } ] ]

).play;

)



// stop player and free HS


p.free;



// order of execution: three Pbinds defined, scheduling slightly time-shifted internally,

// so references can be established


// printout of variables which may be used within a PHS definition

// timeGrains is just a time ID, depending on granularity, not used for scheduling

// demandIndex indicates the index of the stream of durations

// posted demandIndex = 1, as two pbinds are using duration stream #0 



(

p = PHS(h, [], 

0.16, 

[ [\midinote, Pkey(\val) + Pseq([0,2], inf), \amp, 0.06], 

  [\midinote, Pkey(\val) + [-7, 4, 7],

\amp, Pwrand([0.06,0.1], [0.8,0.2], inf),

// "random" appearance of middle voice chords depending on synth values 

\type, Pkey(\val).collect { |x| ~middle = x.asInteger.even.if { \note }{ \rest } } ] ],

Pseq([0.32, 0.16], inf), 

[ [\midinote, Pkey(\val) + [15, 20, 25],

  \legato, 0.2,

  \amp, 0.025,

  // upper voice is playing in case of middle voice rest 

  \type, Pkey(\val).collect { |x| (~middle == \rest).if { \note }{ \rest } },

  \post, Pfunc { |e| e.use {

"demandIndex: ".post; ~demandIndex.postln;

"timeGrains: ".post; ~timeGrains.postln;

"dur: ".post; ~dur.postln;

"val: ".post; ~val.postln;

"================================".postln;

}

}

]]

).play;

)



// stop player and free HS


p.free;