‹ rot Bjorklund ›

Pfork

2010-11-17 00:21 supercollider

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 indices 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 indices 3 will be zeroed out first. After that all indices 1 and so on. The last indices zeroed out (i.e. kept until frac is almost 0.0) are the indices 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

or the same thing but with the 1s removed - just to show the pattern better.

                                 //frac is 1.0
      0                        
      0       0                
      0       0       0        
      0       0       0       0
  0   0       0       0       0
  0   0   0   0   0   0       0
  0   0   0   0   0   0   0   0  //frac is 0.5
  0 0 0   0   0   0   0   0   0
  0 0 0   0 0 0   0   0   0   0
  0 0 0   0 0 0   0 0 0   0   0
  0 0 0   0 0 0   0 0 0   0 0 0
0 0 0 0   0 0 0   0 0 0   0 0 0
0 0 0 0 0 0 0 0   0 0 0   0 0 0
0 0 0 0 0 0 0 0 0 0 0 0   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 help file for more examples.

I plan to (someday) write a Pfunc2 class that works in a similar way but inherits from FilterPattern instead of ListPattern.

Updates:

Attachments:


‹ rot Bjorklund ›