Skip to content

Instantly share code, notes, and snippets.

@widyakumara
Created April 6, 2014 13:31
Show Gist options
  • Save widyakumara/10006111 to your computer and use it in GitHub Desktop.
Save widyakumara/10006111 to your computer and use it in GitHub Desktop.
<title>THX</title><script>mr=Math.random;e="exponentialRampToValueAtTime";l="linearRampToValueAtTime";s="setValueAtTime";h="frequency";c="connect";ac=new(window.AudioContext||window.webkitAudioContext)();d=ac.createDynamicsCompressor();d[c](ac.destination);var os=[];for(i=0;i<30;i++){v=200+mr()*200;os[i]=o=ac.createOscillator();o[h][s](v,0);o.detune[l](mr()*20-10,0);o.type="sawtooth";f=ac.createBiquadFilter();f.type="lowpass";f[h][s](v*8,0);f.Q.value=mr();for(t=0;t<10;t++){if(mr()<0.1){v=200+mr()*200;o[h][e](v,t+mr());f[h][e](v*8,t+mr());}}v=75*Math.pow(2,Math.floor(mr()*mr()*4));o[h][e](v,18+mr());f[h][e](v*15,18+mr());for(t=0;t<15;t++){o.detune[s](mr()*30-15,t*2+mr());}a=ac.createGain();a.gain[s](0,0);a.gain[l](0.1,5+mr()*5);a.gain[s](0.1,22);a.gain[l](0,30);p=ac.createPanner();p.setPosition(mr()*2-1,mr()*2-1,mr()*2-1);o[c](f);f[c](a);a[c](p);p[c](d);o.start(0);o.stop(30);}</script><body style="background:#000"><h1 style="text-align:center;font-size:25em;font-family:sans-serif;color:#fff">THX</h1>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment