
The THX Sound - harel
http://musicthing.blogspot.co.uk/2005/05/tiny-music-makers-pt-3-thx-sound.html
======
bgruber
to clarify:

the THX sound was created by a synthesis program that was probably quite
substantial itself (I have long been under the impression that it was a
MUSIC-N derivative, and Moorer's description seems to confirm it) and, I'm
guessing, probably not written in C. The input to this program was itself
generated by a 20KLoc C program.

EDIT: i figured "i don't have to explain music-n, people can just look it up"
but i just read the wikipedia article and i think that explanation only makes
sense if you already know what it is. so...

MUSIC is a software synthesizer by Max Mathews, considered the father of
computer music synthesis. It consists of a library of 'unit generators' and an
orchestra/score processing system for using them. The "orchestra" file is used
to define "instruments", basically parameterized combinations of unit
generators, which themselves are basic synthesis building blocks (say, a
square wave generator, or in the case of the THX sound, a wavetable
oscillator).

The orchestra is controlled by a score, also known as a note list. This is
just a series of statements saying, basically, "start playing instrument N at
time T with parameters X,Y,Z".

MUSIC was followed by MUSIC-II, MUSIC-III, etc, hence the name "MUSIC-N".
Basically every extant software synthesis package is derived from MUSIC-N on
some level, but Csound is the most direct descendant.

~~~
cydonian_monk
Ah, but what creates a sound? The instrument, or the musician that knows how
to play it? An instrument without a musician is merely silence.

I would argue that if the C program didn't "create" the sound that it was
certainly the musician responsible.

~~~
bgruber
one of the nice things about computer music is the way in which it can be a
collaboration between musician and engineer, so much so that the lines are
frequently blurred. i certainly got the impression from the article that in
this case, Moorer was himself involved in the development of the synthesis
package and even the signal processor itself.

Fundamentally though, you are of course correct. This was a mainframe in the
80s, so presumably there was an operating system and system libraries and they
all played a part, so should we credit those developers as well? it's
tortoises all the way down.

~~~
switz
This same conversation could very easily be applied to OSS.

------
diggum
I have the wonderful fortune of getting to work with Andy, and spoke with him
about this a few years ago. (This story pops up again every two years or so).
Shortly after, he let me know he had taken a look at the code for the first
time in years and had overestimated the line count. I'd have to go back
through old emails but I believe he said it was only something like 2000
lines.

I'm pretty sure he has far more interesting stories to tell than this, and he
is pretty hot on the banjo.

~~~
__mark__
This makes more sense, writing and debugging 20,000 lines of C code in four
days is a little crazy.

~~~
gcb
If itwere 20k lines, he would probably have said something like

"it was a 7 line Perl script that generated 20k lines of c that generated
inputs for whatever"

------
zaph0d
This is the THX sound synthesised using Overtone, a music synthesis program.

    
    
      (definst thx [gate 1]
      (let [target-pitches (map midi->hz [77 74 72 70 65 62 60 58 53 50 46 34 26 22 14 10])
            r-freq         (env-gen:kr (envelope [1 1 0.007 10] [8 4 2] [0 -4 1] 2) gate)
            amp-env        (env-gen:kr (envelope [0 0.07 0.21 0] [8 4 2] [0 1 1] 2) gate :action FREE)
            mk-noise       (fn [ug-osc]
                             (mix (map #(pan2 (ug-osc (+ (* r-freq (+ 230 (* 100 (lf-noise2:kr 1.3))))
                                                         (env-gen:kr (envelope [0 0 %] [8 6] [0 -3]))))
                                              (lf-noise2:kr 5))
                                       target-pitches)))
            saws           (mk-noise saw)
            sins           (mk-noise sin-osc)
            snd            (+ (* saws amp-env) (* sins amp-env))]
        (* 0.5 (g-verb snd 9 0.7 0))))
    

[https://github.com/overtone/overtone/blob/master/examples/th...](https://github.com/overtone/overtone/blob/master/examples/thx.clj)
<http://overtone.github.com/>

~~~
bromagosa
You've just reduced 20000 lines of C to 13 lines of LISP :)

<http://www.youtube.com/watch?v=5-OjTPj7K54>

------
sneak
Macintosh boot chime ROM routine:

<http://www.folklore.org/projects/Macintosh/more/BootBeep.txt>

And the story:

[http://www.folklore.org/StoryView.py?project=Macintosh&s...](http://www.folklore.org/StoryView.py?project=Macintosh&story=Boot_Beep.txt)

~~~
bemmu
Impressed that this short bit of assembler code was responsible for the chime
I hear when I start up my Macbook Pro, I set out to convert it to Javascript.
Well, a few hours into this project when I start hearing the first (still
quite off) results did I learn that actually the current chime is very very
different from the original Mac chime:
<http://www.youtube.com/watch?v=GSuVacw8I-o>

What I don't quite get is that the asm code seems to start with a sharp square
wave that smoothens off as time passes, but in that video the first sound
already sounds very smooth in the beginning.

~~~
Someone
Read
[http://www.mactech.com/articles/develop/issue_16/034-038_Qui...](http://www.mactech.com/articles/develop/issue_16/034-038_QuickTime_column.html),
especially the part that says:

    
    
       "Square wave sounds. Unknown to most, the square wave synthesizer never produced
        true square waves. It was more like a modified sine wave. This has been corrected.
        As a result you'll notice that the Simple Beep sounds different. It can now be
        heard as it was originally designed to sound."

------
kens
If you load the sound into Audacity and view the spectrum (i.e. the FFT), you
can get a moderately clear view of what's happening. For the first 14 seconds,
pitches wander around randomly. Then they start sliding up in several jumps
(interesting not a smooth progression), and end up at the final pitches (both
lower and higher than the beginning) at around 19 seconds. You could probably
extract the pitch tracks from the FFT if you want to re-create this sound.
(I'd like to write up a detailed blog post on this, but don't have time, so
I'll just leave a comment.)

~~~
kens
A few other notes from the spectrum: the final chord is D major, with little
F#. Between 14 and 19 seconds, the pitches take 5 jumps to their destination,
at about .9 seconds per jump. (This is the part that sounds like rising tones
before the final chord.) The jumps aren't synchronized, or else there would be
a 67bpm rhythm to this part. The jumps aren't smooth, but an exponential
decay, where they move rapidly at first, and then slow down. In the first
part, the frequencies wander between about 130 and 260 Hz, with a noticeable
peek at exactly 200 Hz. (And of course the harmonics.)

This will make more sense if you see the spectrum; I've put a picture of the
spectrum at:
[https://picasaweb.google.com/lh/photo/qbuyIVSC2Bsvgxg5HlSD4-...](https://picasaweb.google.com/lh/photo/qbuyIVSC2Bsvgxg5HlSD4-EaoRUAVJWIvGebgDMsook?feat=directlink)
Time is the X axis, and frequency is the Y axis. The lines that move in
parallel are harmonic frequencies.

~~~
mcmire
Wow, that's very neat, thanks.

------
rsiqueira
I think it can be generated with few lines of code using "algorithmic
symphonies" by synthesizing sounds with bit wise operators like this:

((1000/((t/12)%(t>>10))&1) _35 + (1000/((t/23)%(t >>10))&1)_35)

Link to generate (using javascript) and hear the sound above:
<http://bit.do/thx-first-try>

More sounds created like using those simple equations:
[http://js.postbit.com/digital-computer-music-with-bitwise-
op...](http://js.postbit.com/digital-computer-music-with-bitwise-
operators.html)

~~~
paulgerhardt
If we're going about reinventing the wheel see this excellent post from your
forebearers: [http://www.earslap.com/instruction/recreating-the-thx-
deep-n...](http://www.earslap.com/instruction/recreating-the-thx-deep-note)

And discussion from a few years ago:
<http://news.ycombinator.com/item?id=725564>

Don't miss their Deep Note SuperCollider one-liner at the end:
"play{Mix({|k|k=k+1/2;2/k _Mix({|i|i=i+1;Blip.ar(i_
XLine.kr(rand(2e2,4e2),87+LFNoise2.k"

------
woodchuck64
Since only half the links work, here is Deep Note:
<http://www.youtube.com/watch?v=uYMpMcmpfkI> and here is work on recreating it
with SuperCollider: [http://www.earslap.com/instruction/recreating-the-thx-
deep-n...](http://www.earslap.com/instruction/recreating-the-thx-deep-note)

~~~
keane
While <http://www.thx.com/trailers/> doesn't work, there are THX trailers at
<http://www.thx.com/consumer/movies/>

------
huhtenberg
I'm surprised his program didn't print the PRNG seed(s), exactly to allow re-
creating pieces that stood out.

~~~
Drbble
His next program probably did. Live and learn.

------
sparknlaunch12
Funny this blog post is from 2005. I use to have the THX sound play when
logging into Windows (sad times).

The Music Thing blog has some other great posts about music and instrument
hacks.

The reference to the C code is here:

 _"The score consists of a C program of about 20,000 lines of code. The output
of this program is not the sound itself, but is the sequence of parameters
that drives the oscillators on the ASP. That 20,000 lines of code produce
about 250,000 lines of statements of the form "set frequency of oscillator X
to Y Hertz"._

------
nuriaion
20kloc of C sounds like a lot and 4 days like too little. As a comparsion at
work we developed a drive-by-wire system for handicaped car driver. This
Software has around 22kloc of mostly C and some configuration/make files.

~~~
justincormack
You might read the article. The code just sets parameters.

~~~
nuriaion
What i wanted to say is that 20kloc is a lot even for C. (Specially for "only"
generating the parameters. Diggum sad that it was more like 2kloc which sounds
resonable.

------
kragen
This is awesome. Thanks for posting it. However, may I suggest changing the
title to "The THX Deep Note"? I thought it was going to be about the sounds my
father-in-law and George made for their movie THX-1138, the namesake of Dolby
THX, many of which sounds were reused in better-known movies later, such as
Star Wars.

------
rsiqueira
I uploaded the mp3 of THX (Deep Note) to SoundCloud, it's from the 25 seconds
original audio file registered by LucasArts: [http://soundcloud.com/rodrigo-
de-almeida-siqueira/thx-deep-n...](http://soundcloud.com/rodrigo-de-almeida-
siqueira/thx-deep-note-by-lucasarts)

The original file was found in the US Patent and Trademark Office:
<http://tdr.uspto.gov/search.action?sn=74309951>

------
gtani
Cf the windows sounds by Fripp and Eno:

<http://www.loosewireblog.com/2006/11/fripp_eno_and_t.html>

------
dools
I wonder what influence, if any, this sound had on the noise at the start of
"Another part of me" by Michael Jackson:

<http://www.youtube.com/watch?v=cxtsycg6Xgg>

------
joejohnson
The most interesting part is that a sound generated by a pseudo-random process
is copyrightable.

~~~
briandear
The sound itself isn't a 'sound' but a performance. Hence copyrightable. The
process to create that performance could be patented.

------
guard-of-terra
It's the first time I ever hear this. "is the most widely-recognized piece of
computer-generated music in the world" Care to replace "World" with "the USA"?
Because you can't, in fact, say anything meaningful about the whole world.

~~~
prawn
On that line of thinking, can you say anything meaningful about anywhere other
than where you are?

