Friday, August 21, 2009

More 140 character SuperCollider Tweets

Even SuperCollidists aren't immune to the memetic allure of Twitter, there's been a whole load of 140 character SuperCollider programmes appearing both on Twitter and on the SC Users list. Thankfully someone has been kind enough to collect them all up and put them on this page here, at the SC Wiki. Smashing.

Here's a couple of my favorites,

from Fredrik Olofsson

{RHPF.ar(GbmanN.ar([2300,1150]),LFSaw.ar(Pulse.ar(4,[1,2]/8,1,LFPulse.ar(1/8)/5+1))+2)}.play

And from the Venerable Dan

{LocalOut.ar(a=DynKlank.ar(`[LocalIn.ar.clip2(LFPulse.kr([1,2,1/8]).sum/2)**100*100],Impulse.ar(10)));HPF.ar(a).clip2!2}.play//#supercollider

Sunday, August 9, 2009

Recreating the THX sound

In a similar vein to the recreation of the rave hoover here's another reverse engineer and recreation of a famous sound, the tooth shattering TXH Deep Note. You can read the full story on EarSlap, but here's the final code.

//inverting init sort, louder bass, final volume envelope, some little tweaks

(

{

var numVoices = 30;

var fundamentals = ({rrand(200.0, 400.0)}!numVoices).sort.reverse;

var finalPitches = (numVoices.collect({|nv| (nv/(numVoices/6)).round * 12; }) + 14.5).midicps;

var outerEnv = EnvGen.kr(Env([0, 0.1, 1], [8, 4], [2, 4]));

var ampEnvelope = EnvGen.kr(Env([0, 1, 1, 0], [3, 21, 3], [2, 0, -4]), doneAction: 2);



var snd = Mix

({|numTone|



var initRandomFreq = fundamentals[numTone] + LFNoise2.kr(0.5, 6 * (numVoices - (numTone + 1)));

var destinationFreq = finalPitches[numTone] + LFNoise2.kr(0.1, (numTone / 3));

var sweepEnv =

EnvGen.kr(

Env([0, rrand(0.1, 0.2), 1], [rrand(5.5, 6), rrand(8.5, 9)],

[rrand(2.0, 3.0), rrand(4.0, 5.0)]));

var freq = ((1 - sweepEnv) * initRandomFreq) + (sweepEnv * destinationFreq);



Pan2.ar

(

BLowPass.ar(Saw.ar(freq), freq * 6, 0.6),

rrand(-0.5, 0.5),

(1 - (1/(numTone + 1))) * 1.5

) / numVoices

}!numVoices);



Limiter.ar(BLowPass.ar(snd, 2000 + (outerEnv * 18000), 0.5, (2 + outerEnv) * ampEnvelope));

}.play;

)


Apparently the original took 20,000 lines of C code! This is a tad more efficient and sounds very close to the original.