News for hackers. Stuff that matters.
Re:The THX Sound by bgruber on Sunday May 27, 2012 @11:06AM (#4030213)
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.

Re:The THX Sound by cydonian_monk on Sunday May 27, 2012 @11:13AM (#4030227)
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.

Re:The THX Sound by bgruber on Sunday May 27, 2012 @11:23AM (#4030237)
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.

Re:The THX Sound by switz on Sunday May 27, 2012 @11:59AM (#4030305)
This same conversation could very easily be applied to OSS.
Re:The THX Sound by keithpeter on Sunday May 27, 2012 @12:17PM (#4030334)
No idea why you are being downvoted, your point is a sensible one to make.

Composers have a 'musical imagination' and often write at the keyboard of (typically) a piano. Classical composers sometimes write music that is not 'idiomatic' for a particular instrument; adjustments follow. From the original article it seems as if the composer had a definite idea of what he was after and adjusted things until he got close.

What interests me about the original anecdote is the use of random numbers in the parameters, and the difficulty that the composer had in reproducing a particular 'state' of the sample.

Re:The THX Sound by diggum on Sunday May 27, 2012 @12:19PM (#4030341)
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.

Re:The THX Sound by __mark__ on Sunday May 27, 2012 @01:43PM (#4030570)
This makes more sense, writing and debugging 20,000 lines of C code in four days is a little crazy.
Re:The THX Sound by gcb on Sunday May 27, 2012 @01:54PM (#4030598)
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"

Re:The THX Sound by zaph0d on Monday May 28, 2012 @04:12AM (#4032442)
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... http://overtone.github.com/
Re:The THX Sound by bromagosa on Monday May 28, 2012 @01:26PM (#4034198)
You've just reduced 20000 lines of C to 13 lines of LISP :)

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

Re:The THX Sound by sneak on Sunday May 27, 2012 @11:55AM (#4030295)
Re:The THX Sound by bemmu on Sunday May 27, 2012 @11:58PM (#4031861)
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.

Re:The THX Sound by Someone on Monday May 28, 2012 @07:34AM (#4032904)
Read http://www.mactech.com/articles/develop/issue_16/034-038_Qui..., 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."
Re:The THX Sound by kens on Sunday May 27, 2012 @06:26PM (#4031222)
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.)
Re:The THX Sound by kens on Monday May 28, 2012 @02:14PM (#4034389)
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-... Time is the X axis, and frequency is the Y axis. The lines that move in parallel are harmonic frequencies.

Re:The THX Sound by mcmire on Monday May 28, 2012 @05:49PM (#4035060)
Wow, that's very neat, thanks.
Re:The THX Sound by rsiqueira on Sunday May 27, 2012 @12:05PM (#4030318)
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...

Re:The THX Sound by paulgerhardt on Sunday May 27, 2012 @06:08PM (#4031165)
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...

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/kMix({|i|i=i+1;Blip.ar(iXLine.kr(rand(2e2,4e2),87+LFNoise2.k"

Re:The THX Sound by kragen on Sunday May 27, 2012 @10:01PM (#4031646)
That's a very creditable bytebeat version of the THX Deep Note! I recommend:

• Putting a couple of spaces before your formula so the markup processor doesn't chew it up.

• Using Darius Bacon's bytebeat player instead of the old Wurstcaptures one: http://wry.me/bytebeat/?code0=((1000%2F((t%2F12)%25(t%3E%3E1...

If you want to approximate the original more closely, I think you might need sine-wave oscillators rather than square waves. You can get a pretty decent bytebeat sine wave from http://wry.me/bytebeat/?code0=((t%2615)*(-t%2615)%5E!(t%2616..., but most of the time I use a triangle wave instead when the standard sawtooth is too harsh.

I'd like to point out that your bytebeat isn't actually using bitwise operators in any non-arithmetic way; it's equivalent to http://wry.me/bytebeat/?code0=((floor(1000%2F((t%2F12)%25flo..., and in C you can leave out the occurrences of "floor".

Re:The THX Sound by autotravis on Sunday May 27, 2012 @01:31PM (#4030538)
I think you went the wrong direction in pitch, but that method does have potential for sure.
Re:The THX Sound by woodchuck64 on Sunday May 27, 2012 @11:54AM (#4030292)
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...
Re:The THX Sound by keane on Sunday May 27, 2012 @10:57PM (#4031741)
While http://www.thx.com/trailers/ doesn't work, there are THX trailers at http://www.thx.com/consumer/movies/
Re:The THX Sound by huhtenberg on Sunday May 27, 2012 @12:44PM (#4030409)
I'm surprised his program didn't print the PRNG seed(s), exactly to allow re-creating pieces that stood out.
Re:The THX Sound by Drbble on Sunday May 27, 2012 @01:09PM (#4030482)
His next program probably did. Live and learn.
Re:The THX Sound by FreeFull on Sunday May 27, 2012 @05:29PM (#4031062)
Maybe you could write a program that tries successive seeds and compares them to the sample, and then prints which seeds were the closest to the sound.
Re:The THX Sound by sparknlaunch12 on Sunday May 27, 2012 @12:56PM (#4030445)
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".

Re:The THX Sound by nuriaion on Sunday May 27, 2012 @11:12AM (#4030224)
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.
Re:The THX Sound by ams6110 on Sunday May 27, 2012 @12:00PM (#4030307)
LOC is really pretty meaningless, it all depends on how the program was written. If it was a "top to bottom" program with no loops or subroutines (this is the style often seen in COBOL code for example) it could have been a lot of very repetitive code.
Re:The THX Sound by justincormack on Sunday May 27, 2012 @12:02PM (#4030312)
You might read the article. The code just sets parameters.
Re:The THX Sound by nuriaion on Sunday May 27, 2012 @01:41PM (#4030565)
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.
Re:The THX Sound by kragen on Sunday May 27, 2012 @10:04PM (#4031659)
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.
Re:The THX Sound by rsiqueira on Wednesday May 30, 2012 @09:56AM (#4042810)
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...

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

Re:The THX Sound by gtani on Sunday May 27, 2012 @02:21PM (#4030654)
Cf the windows sounds by Fripp and Eno:

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

Re:The THX Sound by dools on Sunday May 27, 2012 @11:54PM (#4031852)
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

Re:The THX Sound by joejohnson on Sunday May 27, 2012 @01:54PM (#4030597)
The most interesting part is that a sound generated by a pseudo-random process is copyrightable.
Re:The THX Sound by briandear on Sunday May 27, 2012 @02:00PM (#4030615)
The sound itself isn't a 'sound' but a performance. Hence copyrightable. The process to create that performance could be patented.
Re:The THX Sound by jonhendry on Monday May 28, 2012 @03:21AM (#4032337)
The editing, the selection of that particular iteration as being the "right" one is part of the copyrighted material.

And it isn't merely generated by a pseudo-random process, it's generated by code written and adjusted to produce a sound within certain parameters, with variation within those parameters provided by pseudo-random perturbations.

That said, I'm sure you could also record the sound of birds chirping in the dawn chorus, with even less input from the recording individual other than selecting a particular portion of the recorded audio, and copyright that.

Re:The THX Sound by comex on Sunday May 27, 2012 @07:28PM (#4031345)
Any traditional performance is a pseudo-random process - it doesn't come out exactly the same way every time.
Re:The THX Sound by muyuu on Sunday May 27, 2012 @01:59PM (#4030612)
Well, the process is not pseudo-random but pseudo-randomised.

But I agree with the sentiment, that's really interesting.

Re:The THX Sound by guard-of-terra on Sunday May 27, 2012 @06:57PM (#4031279)
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.
Re:The THX Sound by prawn on Sunday May 27, 2012 @09:02PM (#4031533)
On that line of thinking, can you say anything meaningful about anywhere other than where you are?