Sunday, July 8, 2012

Output HTML Documentation of Your Code with Textmate

Just a tip - if you want to publish code examples from TextMate and include the syntax highlighting of your TextMate theme, you can run the command:

Bundles -> Textmate -> Create HTML from Document

There's also a command in there to create a css stylesheet from your theme.


/* define synths and send to servers */
SynthDef("pulser",{|freq=100,m=#[1,1,1,1], atk=1,fatk=1, rel=1, sus=1, w=0.5,amp=0.005,pan =0,gate=0,sw=8,r=(0.5),out=0,mrate=1|, m * freq ,w
,0.5 * 5 * amp/(((freq)+256))),(,0,0.5,0,w)*freq*,sw, rel*2,'sine'),gate, doneAction:2)).clip(32,2**14),r,1),pan)) *,1, rel,'sine'),gate, doneAction:0) );}).send(z);

SynthDef("sine-cluster",{|freq=100, atk=1, rel=1, sus=1, amp=0.005,pan =0,gate=0|,  [1,1] * freq,0,7 * amp/(((freq)+256))),pan)) *,rel, 1,sus),gate, doneAction:2) );}).send(z);

/* Define functions for playing our synths */
~sineClusterplayer = {|f=64,scaleDegree=1,overtones=([1,3,7,13,16]),articulation=1,cycle=1,amp=1,step=1|
  //step thru a collection of overtones
    //play a tight cluster of 8 sines, slightly detuned from the overtone{|clusterTone|
        var sn = Synth("sine-cluster",nil,~z.wrapAt(clusterTone+num)),freq,
        freq = f * scaleDegree * overtone;
        freq = freq * (freq > 128).if({~pitchTweak.(clusterTone,cycle,num)},{1});//just a little detune if we're not too deep in the bass
        sn.set(\atk,(1/64) + ((num*overtone)/64) );//higher overtones have longer attack
        sn.set(\amp,1.5 * amp);
        sn.set(\rel,(48 * ~t * ~tempo) / ~scale.size.clip(2,32).log2);
        sn.set(\sus,-1.125 * articulation * accent * (scaleDegree%overtone).clip(2,~scale.size).asInt.factors[0].log2);
        sn.set(\pan,([1,-1] /.x (2..6)).sort.wrapAt(clusterTone+step+num));

No comments:

Post a Comment