Chiptune, Dub, BBCut

This is based off MCLD’s Dubstep Patch, with a modification to make it output a Pulse wave and then using some BBCut from a previous post.

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


SynthDef(dub, {|out = 0, amp|
 
    var trig, note, son, sweep;

    trig = CoinGate.kr(0.5, Impulse.kr(/*2*/ 1.5.reciprocal));

    note = Demand.kr(trig, 0, Dseq((22,24..44).midicps.scramble, inf));

    sweep = LFSaw.ar(Demand.kr(trig, 0, Drand([1, 2, 2, 3, 4, 5, 6, 8, 16], inf))).exprange(40, 5000);

    son = Pulse.ar(note * [0.99, 1, 1.01]).sum;
    son = LPF.ar(son, sweep);   
    son = Normalizer.ar(son);
    son = son + BPF.ar(son, 2000, 2);

    //////// special flavours:
    // hi manster
    son = Select.ar(TRand.kr(trig: trig) < 0.05, [son, HPF.ar(son, 1000) * 4]);
    // sweep manster
    son = Select.ar(TRand.kr(trig: trig) < 0.05, [son, HPF.ar(son, sweep) * 4]);
    // decimate
    son = Select.ar(TRand.kr(trig: trig) < 0.05, [son, son.round(0.1)]);

    son = (son * 5).tanh;
    //son = son + GVerb.ar(son, 10, 0.1, 0.7, mul: 0.3);
    //son.dup;
    Out.ar(out, son.dup * amp);
}).add;


 // 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= Bus.audio(s,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.  90 is the BPM / 60 for the number of seconds in a minute
 TempoClock.default.tempo_(180/60);

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

  s.sync; // wait for buffers to load

 loop = (instrument:dub, out:0, amp: 0.3,
    group:synthgroup.nodeID).play(clock.tempoclock);

  /* 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
  5.wait;
  
  group = CutGroup(CutBuf3(sf, 0.5));
  group.add(CutBit1.new(4));
    cut2 = BBCut2(group, BBCutProc11(8, 4, 16, 2, 0.2)).play(clock);

  
  // 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);

 2.wait;
 
   loop.set(out, bus.index);
   
 "bbcut".postln;
 
 30.wait;
 
   cut4 = BBCut2(CutGroup(CutStream1(bus.index, buf), bbgroup), 
    SQPusher2.new).play(clock);

   
 });
)

I think it would be cool to run the drums through a 4 or 8 bit MantissaMask, but first I have to figure out how to write FX.

Published by

Charles Céleste Hutchins

Supercolliding since 2003

One thought on “Chiptune, Dub, BBCut”

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.