pfork

clean-up #2:
another very old supercollider class i never got around to publish. it's called Pfork and makes it possible to blend or fade out patterns in other ways than plain [volume] crossfading. It was originally written for the installation Intelligent Street (in SC2) where it was used as a way of creating new music styles from a mix of multiple other styles.

here's one example of slowly zeroing out amplitudes in a 16 step pattern. frac is a value slowly changing from 1.0 to 0.0 and indicates how many values to zero out. the fork pattern is [3, 1, 2, 0]. this pattern decides which indexes to zero out and in which order. so here index 3 is first in the fork pattern and will thereby be seen as the least important in the original pattern. all indexes 3 will be zeroed out first. after that all indexes 1 and so on. the last indexes zeroed out (ie kept until frac is almost 0.0) are the indexes 0 - ie the first beat out of 4 in the original amplitude step pattern.
this ascii printout should help visualise what is happening...

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1         //frac is 1.0
1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1
1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1
1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0
1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 0
1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0         //frac is 0.5
1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0
1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0
1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0
1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0
0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0         //frac is 0.0

one can also imagine 1 or 0 to be other things than amplitude and basically any array can fork into any other.
here's an example going slowly from one melodic pattern into another. (mp3 recording below)

//slowly fork from one pattern to another in the opposite channel
(
a= 0.2.dup(16); //amplitudes
f= [0, 2, 1, 3];        //forkpattern for left channel
g= [3, 1, 2, 0];        //forkpattern for right channel
Pbind(\pan, -1, \dur, 0.125, \degree, Pseq([5, 6, 7, 8], inf), \amp, Pfork(a, f, Pseries(1, -0.1, 11), 0, 11)).play;
Pbind(\pan, 1, \dur, 0.125, \degree, Pseq([3, 2, 1, 0], inf), \amp, Pfork(a, g, Pseries(0, 0.1, 11), 0, 11)).play;
)

see the helpfile for more examples.
i plan to (someday) write a Pfunc2 class that work in a similar way but inherits from FilterPattern instead of ListPattern.


AttachmentSize
Package icon Pfork.zip3.74 KB