# 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.

• Please avoid Import[youtube] answers Dec 26 '13 at 22:03
• To "generate" a sound would generally preclude importing a pre-generated sound from elsewhere. Dec 26 '13 at 22:16
• The spec is too loose. I believe I could write a program that has 30 waveforms (any) that start at 250 Hz, play that for a second, divide into three groups, 250, 500 and 1000 Hz (three octaves), play that for a second and end up with detuning the 1000 Hz group. Specifying that it should be "recognizable" would make the objectivity of the winner a problem. I think this would work better as a popularity contest. Dec 27 '13 at 1:38
• I'm thinking so too now, which means I'll post a second version of this problem which is a popularity contest instead. (The loose spec should make for some interesting short solutions, at least.) Dec 27 '13 at 2:24
• There's already a 140 character solution. Jan 3 '14 at 0:02

# C, 323 bytes

#include<math.h>
#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++<30;r[i]=.5-(9*i%7)/7.);for(i=0;i++<9*e;){x=2.*M_PI*i/(0.+e),k=y=1-i/(8.*e),v=0,A,A,A,y=y>1?1:y;for(j=0;j++<30;o=j%6,v+=(7-o)*.1*sin(x*(20<<o)*(1+y*r[j])));write(1,&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 > deep-note.wav