{"id":243,"date":"2010-10-12T18:00:00","date_gmt":"2010-10-12T17:00:00","guid":{"rendered":"http:\/\/www.celesteh.com\/blog\/2010\/10\/12\/stupid-bbcut-tricks\/"},"modified":"2015-06-19T00:23:30","modified_gmt":"2015-06-18T23:23:30","slug":"stupid-bbcut-tricks","status":"publish","type":"post","link":"https:\/\/www.celesteh.com\/blog\/2010\/10\/12\/stupid-bbcut-tricks\/","title":{"rendered":"Stupid BBCut Tricks"},"content":{"rendered":"<p>I&#8217;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 <a href=\"http:\/\/www.celesteh.com\/music\/brum\/stupid-bbcut-tricks.mp3\">output<\/a> which it creates.  In order to play at home, you need a particular <a href=\"http:\/\/www.freesound.org\/samplesViewSingle.php?id=22127\">sample<\/a>.<\/p>\n<pre>\n(\n\n var bus, sf, buf, clock, synthgroup, bbgroup, loop, group, cut1, cut2, cut3, stream, pb,\n  cut4, out;\n\n \/\/ this first synth is just to play notes\n SynthDef(squared, { |out, freq, amp, pan, dur|\n  \n  var tri, env, panner;\n  \n  env = EnvGen.kr(Env.triangle(dur, amp), doneAction: 2);\n  tri = MantissaMask.ar(Saw.ar(freq, env), 8);\n  panner = Pan2.ar(tri, pan);\n  Out.ar(out, panner)\n }).add;\n \n \n \/\/ a looping buffer player\n SynthDef(loop, { |out = 0, bufnum = 0, amp = 0.2, loop=1|\n\n  var player;\n  \n  player = PlayBuf.ar(2, bufnum, 2 * BufRateScale.kr(bufnum), loop: loop, doneAction:2);\n  Out.ar(out, player * amp);\n }).add;\n \n \/\/ groups\n synthgroup= Group.head(Node.basicNew(s,1)); \/\/ one at the head\n bbgroup= Group.after(synthgroup); \/\/ this one comes after, so it can do stuff with audio\n        \/\/ from the synthgroup\n bus= Bus.audio(s,1); \/\/ a bus to route audio around\n\n \/\/ a buffer holding a breakbeat. The first argument is the filename, the second is the number of\n \/\/ beats in the file.\n sf = BBCutBuffer(\"sounds\/drums\/breaks\/hiphop\/22127__nikolat__oldskoolish_90bpm.wav\", 16);\n \n \/\/ a buffer used by BBCut to hold anaylsis\n buf = BBCutBuffer.alloc(s,44100,1);\n \n \/\/  The default clock.  180 is the BPM \/ 60 for the number of seconds in a minute\n TempoClock.default.tempo_(180\/60);\n\n \/\/ BBCut uses it's own clock class. We're using the default clock as a base\n clock= ExternalClock(TempoClock.default); \n clock.play;  \n \n \/\/ Where stuff actually happens\n Routine.run({\n\n  s.sync; \/\/ wait for buffers to load\n  \n  \/\/ start playing the breakbeat\n  loop = (instrument:loop, out:0, bufnum: sf.bufnum, amp: 0.5, loop:1, \n    group:synthgroup.nodeID).play(clock.tempoclock);\n\n  \/* That's an <a href=\"http:\/\/sc3howto.blogspot.com\/2010\/08\/event.html\">Event<\/a>, which you can create by using parens like this.  We're using\n  an event because of the timing built in to that class.  Passing the clock\n  argument to play means that the loop will always start on a beat and thus be \n  synced with other BBCut stuff. *\/\n  \n  \/\/ let it play for 5 seconds\n  5.wait;\n  \n  \/\/ start a process to cut things coming in on the bus\n  cut1 = BBCut2(CutGroup(CutStream1(bus.index, buf), bbgroup), \n   BBCutProc11(8, 4, 16, 2, 0.2)).play(clock);\n\n  \/*  \n  We use a cut group to make sure that the BBCut synths get added to the bbgroup.\n  This is to make sure that all the audio happens in the right order.\n  \n  CutStream1 cuts up an audio stream. In this case, from our bus.  It uses a buffer to \n  hold analysis data.\n  \n  BBCutProc11 is a cut proceedure.  \n  The arguments are: sdiv, barlength, phrasebars, numrepeats, stutterchance, \n  stutterspeed, stutterarea\n  * sdiv - is subdivision. 8 subdivsions gives quaver (eighthnote) resolution.\n  * barlength - is normally set to 4 for 4\/4 bars. If you give it 3, you get 3\/4\n  * phrasebars - the length of the current phrase is barlength * phrasebars\n  * numrepeats - Total number of repeats for normal cuts. So 2 corresponds to a \n  particular size cut at one offset plus one exact repetition.\n  * stutterchance - the tail of a phrase has this chance of becoming a repeating \n  one unit cell stutter (0.0 to 1.0)\n\n  For more on this, see the helpfile.\n  \n  And we play it with the clock to line everything up\n  *\/\n\n  \/\/ wait a bit, so the BBCut2 stuff has a time to start\n  2.wait;\n\n  \/\/ change the output of the looping synth from 0 to the bus, so the BBCut buffer\n  \/\/ can start working on it\n  loop.set(out, bus.index);\n  \n  \/\/ let it play for 5 seconds\n  5.wait;\n  \n  \/\/ start another BBCut process, this one just using the sound file.\n  cut2 = BBCut2(CutBuf3(sf, 0.3), BBCutProc11(8, 4, 16, 2, 0.2)).play(clock);\n  \/\/ We use CutBuf instead of CutStream, because we're just cutting a buffer\n  \n  \/\/ stop looping the first synth we started\n  loop.set(loop, 0);\n\n  cut1.stop;\n\n  10.wait;\n  \n  \/\/ To add in some extra effects, we can use a CutGroup\n  group = CutGroup(CutBuf3(sf, 0.5));\n  cut3 = BBCut2(group, BBCutProc11(8, 4, 16, 2, 0.2)).play(clock);\n\n  \/\/ play is straight for 5 seconds\n  5.wait;\n\n  \/\/ add a couple of filters to our cutgroup\n  group.add(CutMod1.new);\n  group.add(CutBRF1({rrand(1000,5000)},{rrand(0.1,0.9)},{rrand(1.01,1.05)}));\n\n  10.wait;\n  \n  \/\/ we can take the filters back off\n  group.removeAt(2);\n  group.removeAt(2);\n  \n  \/\/ we can use BBCut cut proceedures to control Pbinds\n  stream = CutProcStream(BBCutProc11.new);\n  \n  pb = Pbindf(\n   stream,\n   instrument, squared,\n   scale,  Scale.gong,\n   degree,  Pwhite(0,7, inf),\n   octave,  Prand([2, 3], inf),\n   amp,  0.2,\n   sustain,  0.01,\n   out,  0,\n   group,  synthgroup.nodeID\n  ).play(clock.tempoclock);\n\n  \/\/ the stream provides durations\n  \n  10.wait;\n  \n  \/\/ We can also process this is like we did the loop at the start\n  \n  pb.stop;\n  pb = Pbindf(\n   stream,\n   instrument, squared,\n   scale,  Scale.gong,\n   degree,  Pwrand([Pwhite(0,7, inf), rest], [0.8, 0.2], inf),\n   octave,  Prand([3, 4], inf),\n   amp,  0.2,\n   sustain,  0.01,\n   out,  bus.index,\n   group,  synthgroup.nodeID\n  ).play(clock.tempoclock);\n  \n  \n  \n  cut4 = BBCut2(CutGroup(CutStream1(bus.index, buf), bbgroup), \n    SQPusher2.new).play(clock);\n    \n  \/\/ SQPusher2 is another cut proc\n  \n  \n  30.wait;\n  cut3.stop;\n  5.wait;\n  cut2.stop;\n  1.wait;\n  cut4.stop;\n  pb.stop;\n  \n })\n)\n<\/pre>\n<div class=\"powerpress_player\" id=\"powerpress_player_9064\"><audio class=\"wp-audio-shortcode\" id=\"audio-243-1\" preload=\"none\" style=\"width: 100%;\" controls=\"controls\"><source type=\"audio\/mpeg\" src=\"http:\/\/www.celesteh.com\/music\/brum\/stupid-bbcut-tricks.mp3?_=1\" \/><a href=\"http:\/\/www.celesteh.com\/music\/brum\/stupid-bbcut-tricks.mp3\">http:\/\/www.celesteh.com\/music\/brum\/stupid-bbcut-tricks.mp3<\/a><\/audio><\/div><p class=\"powerpress_links powerpress_links_mp3\" style=\"margin-bottom: 1px !important;\">Podcast: <a href=\"http:\/\/www.celesteh.com\/music\/brum\/stupid-bbcut-tricks.mp3\" class=\"powerpress_link_pinw\" target=\"_blank\" title=\"Play in new window\" onclick=\"return powerpress_pinw('https:\/\/www.celesteh.com\/blog\/?powerpress_pinw=243-podcast');\" rel=\"nofollow\">Play in new window<\/a> | <a href=\"http:\/\/www.celesteh.com\/music\/brum\/stupid-bbcut-tricks.mp3\" class=\"powerpress_link_d\" title=\"Download\" rel=\"nofollow\" download=\"stupid-bbcut-tricks.mp3\">Download<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;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, &hellip; <a href=\"https:\/\/www.celesteh.com\/blog\/2010\/10\/12\/stupid-bbcut-tricks\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Stupid BBCut Tricks<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[1],"tags":[142,76,64],"class_list":["post-243","post","type-post","status-publish","format-standard","hentry","category-uncategorised","tag-bbcut","tag-celesteh","tag-supercollider"],"_links":{"self":[{"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/posts\/243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/comments?post=243"}],"version-history":[{"count":1,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/posts\/243\/revisions"}],"predecessor-version":[{"id":2443,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/posts\/243\/revisions\/2443"}],"wp:attachment":[{"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/media?parent=243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/categories?post=243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/tags?post=243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}