Skip to content

Commit

Permalink
Merge pull request #9 from schollz/main
Browse files Browse the repository at this point in the history
thx drone
  • Loading branch information
tyleretters committed Aug 18, 2020
2 parents 74286a2 + de78bd8 commit e6e8cf1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions engine/drones/Thx.scd
@@ -0,0 +1,26 @@
// @infinitedigits
// THX
// http://earslap.com/article/recreating-the-thx-deep-note.html
{
arg out, hz=55.1, amp=0.02, amplag=0.02, hzlag=0.01;
var amp_ = Lag.ar(K2A.ar(amp), amplag);
var hz_ = Lag.ar(K2A.ar(hz), hzlag);

var numVoices = 12;
var fundamentals = ({rrand(100.0, 500.0)}!numVoices).sort.reverse;
var finalPitches = (numVoices.collect({|nv| hz_*(2**((nv/2).round-3)); }));
var sweepFactors = ({rrand(0.2,2)}!numVoices);
var voices=(1..numVoices-1).collect({|numTone|
var initRandomFreq = fundamentals[numTone] + LFNoise2.kr(0.5, 6 * (numVoices - (numTone + 1)));
var destinationFreq = finalPitches[numTone] + LFNoise2.kr(0.1, (numTone / 2));
var sweepFactor = sweepFactors[numTone];
var sweepEnv = amp_;
var freq = ((1 - (sweepEnv**sweepFactor)) * initRandomFreq) + ((sweepEnv**sweepFactor) * destinationFreq);
Pan2.ar(
BLowPass.ar(Saw.ar(freq), freq * 6, 0.6),
rrand(-0.6, 0.6),
((1 - (1/(numTone + 1)))**4) +0.4
) / numVoices
});
Out.ar(out,Mix.ar(voices));
}

0 comments on commit e6e8cf1

Please sign in to comment.