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.
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.
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.
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.
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.
"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."
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.)
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.
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.
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.
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".
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.
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.
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.
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.
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.
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.
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.