SuperCollider CLASSES (extension)
Libraries>BBCut

# MultiProc

Allows selection between multiple breakbeat cutting algorithms
Source: /Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/BBCut/classes/bbcutprocs/MultiProc.sc
Inherits from: BBCutProc : Object
See also: BBCut

## Description

With this class you may select which of a number of cut procedures to use on the fly. The selection is from an array of BBCutProc derived objects (which might include a further MultiProc!). The index is chosen on a per phrase, or per block basis, by passed valid index returning functions. If a blockfunc is provided, then the selection is always per block. Otherwise it is per phrase. Note that for convoluted switches between many cut procedures at block rate it becomes very unpredictable when phrases start and end, since multiple phrases are bundled together at once.

## Class Methods

### *new (procs, phrasefunc, blockfunc)

#### Arguments:

procs | An array of cut procedure objects.
phrasefunc | a function that returns a valid index into the procs array.
blockfunc | a function that returns a valid index into the procs array. phrasefunc and blockfunc may be set to nil if unneeded. The default behaviour with all nil is a phrasefunc that randomly selects any index up to procs.size.

### Inherited class methods

## Instance Methods

### -initMultiProc (p, pf, bf)

Arguments as for new.

All other methods override the base to pass messages to the currently selected procedure, and update that procedure based on the phrase or block func.

### Inherited instance methods

### Undocumented instance methods

### -attachsynth (bbcs)

### -chooseblock

### -phraseover

## Examples

    ( //test- default behaviour (random choice between cutprocs after each phrase)
    var sf, clock, cutsynth, cutproc;

    clock= ExternalClock(TempoClock(2.7725));
    clock.play;

    Routine.run({

    sf= BBCutBuffer(Platform.resourceDir +/+ "sounds/break2.aiff",4);

    s.sync; //this forces a wait for the Buffer to load

    cutsynth= CutBuf2(sf);
    cutproc=MultiProc.new([WarpCutProc1.new,BBCutProc11.new]);

    g=BBCut2(cutsynth,cutproc).play(clock);
    });

    )

    ( //test- block speed choice of procedure
    var sf, clock, cutsynth, cutproc;

    clock= ExternalClock(TempoClock(2.7725));
    clock.play;

    Routine.run({

    sf= BBCutBuffer(Platform.resourceDir +/+ "sounds/break2.aiff",4);

    s.sync; //this forces a wait for the Buffer to load

    cutsynth= CutBuf2(sf);
    cutproc=MultiProc.new([BBCPPermute(4.0,8,{|i,n| (i**(i+1))%n},{[1,2].choose}),SQPusher1(0.7,2,0.5)],nil,{2.rand});

    g=BBCut2(cutsynth,cutproc).play(clock);
    });

    )

    ( //fill every 4th bar- plain loop otherwise
    var sf, clock, cutsynth, cutproc, pseq;

    pseq=Pseq([0,0,0,1],inf).asStream;

    clock= ExternalClock(TempoClock(2.7725));
    clock.play;

    Routine.run({

    sf= BBCutBuffer(Platform.resourceDir +/+ "sounds/break2.aiff",4);

    s.sync; //this forces a wait for the Buffer to load

    cutsynth= CutBuf1(sf);
    cutproc=MultiProc.new([BBCutProc.new,WarpCutProc1(phraselength:4.0)],{pseq.next});

    g=BBCut2(cutsynth,cutproc).play(clock);
    });

    )

    ( //fills 2- more complex pattern
    var sf, clock, cutsynth, cutproc, pseq;
    var x,y;

    pseq=Pseq([0,0,0,1,0,0,0,2],inf).asStream;

    clock= ExternalClock(TempoClock(2.7725));
    clock.play;

    Routine.run({

    sf= BBCutBuffer(Platform.resourceDir +/+ "sounds/break2.aiff",4);

    s.sync; //this forces a wait for the Buffer to load

    cutsynth= CutBuf1(sf);
    cutproc=MultiProc.new([
    BBCutProc.new, //for plain play
    WarpCutProc1({0.5},phraselength:4.0),       //for obvious fill
    BBCPPermute(4.0,8,{arg i,n; ((i*y)%n).asInteger},{z})
    ],{

    z=[2,4,8].choose; y= rrand(3,12.3);

    pseq.next});

    g=BBCut2(cutsynth,cutproc).play(clock);
    });

    )

helpfile source: /Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/BBCut/HelpSource/Classes/MultiProc.schelp
link::Classes/MultiProc::
sc version: 3.8.0