Build a script to generate the Deep Note The THX deep note is one of the most recognizable sounds in audio/video production technology. According to its creator, it took about 20,000 lines of C code to generate the final result. We can do better than that.

Your task is to write a script in any language that will generate a sound (to a file or directly to hardware) that fits the trademark description of the THX sound, as provided by the US Patent and Trademark office:


  The THX logo theme consists of 30 voices over seven measures, starting in a narrow range, 200 to 400 Hz, and slowly diverting to preselected pitches encompassing three octaves. The 30 voices begin at pitches between 200 Hz and 400 Hz and arrive at pre-selected pitches spanning three octaves by the fourth measure. The highest pitch is slightly detuned while there are double the number of voices of the lowest two pitches.


Note that the "preselected pitches" must be roughly the same as the pitches in the actual THX deep note, which are in the key of E flat.

The shortest code to do so in any language wins.
C, 323 bytes

#include&lt;math.h&gt;
#define A y=-2*y*y*y+3*y*y
main(i,j,o,e){e=44100;write(1,"RIFF´9WAVEfmt      D¬  ±    data9",44);float r[30],x,y,k,v;for(i=0;i++&lt;30;r[i]=.5-(9*i%7)/7.);for(i=0;i++&lt;9*e;){x=2.*M_PI*i/(0.+e),k=y=1-i/(8.*e),v=0,A,A,A,y=y&gt;1?1:y;for(j=0;j++&lt;30;o=j%6,v+=(7-o)*.1*sin(x*(20&lt;&lt;o)*(1+y*r[j])));write(1,&amp;v,4);}}


(among others, NUL characters could't be pasted in the textbox; you can view or download the original file here)

Usage:

gcc deep-note.c -o deep-note
./deep-note &gt; deep-note.wav


Click here to listen to a preview of the generated sound!