11
\$\begingroup\$

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.

\$\endgroup\$
6
  • \$\begingroup\$ Please avoid Import[youtube] answers \$\endgroup\$ Dec 26 '13 at 22:03
  • \$\begingroup\$ To "generate" a sound would generally preclude importing a pre-generated sound from elsewhere. \$\endgroup\$
    – Joe Z.
    Dec 26 '13 at 22:16
  • 3
    \$\begingroup\$ 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. \$\endgroup\$
    – shiona
    Dec 27 '13 at 1:38
  • \$\begingroup\$ 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.) \$\endgroup\$
    – Joe Z.
    Dec 27 '13 at 2:24
  • 2
    \$\begingroup\$ There's already a 140 character solution. \$\endgroup\$
    – MSalters
    Jan 3 '14 at 0:02
2
\$\begingroup\$

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

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

\$\endgroup\$
4
  • \$\begingroup\$ good try, but it ends up sounding heavily simplified from the original \$\endgroup\$
    – qwr
    Mar 29 '14 at 0:14
  • 2
    \$\begingroup\$ I does indeed; the original uses 30 oscillators controlled by the 20000 lines of code the question referred in the question. This minimalist source code contains less than 400 bytes... What do you offer? \$\endgroup\$ Mar 29 '14 at 0:19
  • 1
    \$\begingroup\$ This one sounds like the Deep Note got passed through a 200 bps MP3 encoding sampled at 1 kHz. \$\endgroup\$
    – Joe Z.
    Mar 29 '14 at 3:30
  • \$\begingroup\$ Still, +1 for even attempting to answer this question. \$\endgroup\$
    – Joe Z.
    Mar 29 '14 at 3:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.