Stupid BBCut Tricks

I’ve been messing a out with the BBCut Library and will shortly be generating some documentation for my students. In the mean time, I give you some commented source code and the output which it creates. In order to play at home, you need a particular sample.


 var bus, sf, buf, clock, synthgroup, bbgroup, loop, group, cut1, cut2, cut3, stream, pb,
  cut4, out;

 // this first synth is just to play notes
 SynthDef(squared, { |out, freq, amp, pan, dur|
  var tri, env, panner;
  env =, amp), doneAction: 2);
  tri =, env), 8);
  panner =, pan);, panner)
 // a looping buffer player
 SynthDef(loop, { |out = 0, bufnum = 0, amp = 0.2, loop=1|

  var player;
  player =, bufnum, 2 *, loop: loop, doneAction:2);, player * amp);
 // groups
 synthgroup= Group.head(Node.basicNew(s,1)); // one at the head
 bbgroup= Group.after(synthgroup); // this one comes after, so it can do stuff with audio
        // from the synthgroup
 bus=,1); // a bus to route audio around

 // a buffer holding a breakbeat. The first argument is the filename, the second is the number of
 // beats in the file.
 sf = BBCutBuffer("sounds/drums/breaks/hiphop/22127__nikolat__oldskoolish_90bpm.wav", 16);
 // a buffer used by BBCut to hold anaylsis
 buf = BBCutBuffer.alloc(s,44100,1);
 //  The default clock.  180 is the BPM / 60 for the number of seconds in a minute

 // BBCut uses it's own clock class. We're using the default clock as a base
 clock= ExternalClock(TempoClock.default);;  
 // Where stuff actually happens{

  s.sync; // wait for buffers to load
  // start playing the breakbeat
  loop = (instrument:loop, out:0, bufnum: sf.bufnum, amp: 0.5, loop:1, 

  /* That's an Event, which you can create by using parens like this.  We're using
  an event because of the timing built in to that class.  Passing the clock
  argument to play means that the loop will always start on a beat and thus be 
  synced with other BBCut stuff. */
  // let it play for 5 seconds
  // start a process to cut things coming in on the bus
  cut1 = BBCut2(CutGroup(CutStream1(bus.index, buf), bbgroup), 
   BBCutProc11(8, 4, 16, 2, 0.2)).play(clock);

  We use a cut group to make sure that the BBCut synths get added to the bbgroup.
  This is to make sure that all the audio happens in the right order.
  CutStream1 cuts up an audio stream. In this case, from our bus.  It uses a buffer to 
  hold analysis data.
  BBCutProc11 is a cut proceedure.  
  The arguments are: sdiv, barlength, phrasebars, numrepeats, stutterchance, 
  stutterspeed, stutterarea
  * sdiv - is subdivision. 8 subdivsions gives quaver (eighthnote) resolution.
  * barlength - is normally set to 4 for 4/4 bars. If you give it 3, you get 3/4
  * phrasebars - the length of the current phrase is barlength * phrasebars
  * numrepeats - Total number of repeats for normal cuts. So 2 corresponds to a 
  particular size cut at one offset plus one exact repetition.
  * stutterchance - the tail of a phrase has this chance of becoming a repeating 
  one unit cell stutter (0.0 to 1.0)

  For more on this, see the helpfile.
  And we play it with the clock to line everything up

  // wait a bit, so the BBCut2 stuff has a time to start

  // change the output of the looping synth from 0 to the bus, so the BBCut buffer
  // can start working on it
  loop.set(out, bus.index);
  // let it play for 5 seconds
  // start another BBCut process, this one just using the sound file.
  cut2 = BBCut2(CutBuf3(sf, 0.3), BBCutProc11(8, 4, 16, 2, 0.2)).play(clock);
  // We use CutBuf instead of CutStream, because we're just cutting a buffer
  // stop looping the first synth we started
  loop.set(loop, 0);


  // To add in some extra effects, we can use a CutGroup
  group = CutGroup(CutBuf3(sf, 0.5));
  cut3 = BBCut2(group, BBCutProc11(8, 4, 16, 2, 0.2)).play(clock);

  // play is straight for 5 seconds

  // add a couple of filters to our cutgroup

  // we can take the filters back off
  // we can use BBCut cut proceedures to control Pbinds
  stream = CutProcStream(;
  pb = Pbindf(
   instrument, squared,
   scale,  Scale.gong,
   degree,  Pwhite(0,7, inf),
   octave,  Prand([2, 3], inf),
   amp,  0.2,
   sustain,  0.01,
   out,  0,
   group,  synthgroup.nodeID

  // the stream provides durations
  // We can also process this is like we did the loop at the start
  pb = Pbindf(
   instrument, squared,
   scale,  Scale.gong,
   degree,  Pwrand([Pwhite(0,7, inf), rest], [0.8, 0.2], inf),
   octave,  Prand([3, 4], inf),
   amp,  0.2,
   sustain,  0.01,
   out,  bus.index,
   group,  synthgroup.nodeID
  cut4 = BBCut2(CutGroup(CutStream1(bus.index, buf), bbgroup),;
  // SQPusher2 is another cut proc

Published by

Charles Céleste Hutchins

Supercolliding since 2003

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.