THX theme in SuperCollider

THX theme in SuperCollider

The THX “Deep Note” was composed by Lucasfilm sound engineer Dr. James Moorer and premiered in 1983 at the debut of “Star Wars: Episode VI.” The original was written in hundreds of lines of C code. However, as a demonstration of SuperCollider, I found it engaging to program in fewer than 100 lines.

the score

The score itself is a remarkably concise piece of music, shown below in its entirity.

THX score

It provides all necessary details for reconstruction:

  1. Use three detuned voices for high notes and two for low notes.
  2. Generate random pitches between 200 and 400 Hz.
  3. Oscillate pitches for approximately 10 seconds.
  4. Approach final pitch over approximately 6 seconds.
  5. Hold final pitches for 24 seconds.
  6. Gradually increase volume until the end.

Let’s try!

the final pitches

Lets start at the end, rather than the beginning to make things easier. The final notes, from the score, are D1, D2, A2, D3, A3, D4, A4, D5, A5, D6, and F#6. We can gather all these notes as midi notes - [26, 38, 45, 50, 57, 62, 69, 74, 81, 86, 90] and create a little Routine in SuperCollider that will play a “thx” synth (to be determined). But here we are:

(
s.waitForBoot({  
  Routine {
    // sync the server
    s.sync;
    // D1, D2, A2, D3, A3, D4, A4, D5, A5, D6, and F#6
    ~thxNotes = [26, 38, 45, 50, 57, 62, 69, 74, 81, 86, 90];
    // play all notes
    Synth.tail(s,"out");
    ~thxNotes.do({ arg v;
      if (v<60,{
        // 2 voices
        Synth("thx",[\noteFinal,v]);
        Synth("thx",[\noteFinal,v]);
      },{
        // 3 voices, slightly detuneds
        Synth("thx",[\noteFinal,v+rrand(-0.1,0.1)]);
        Synth("thx",[\noteFinal,v+rrand(-0.1,0.1)]);
        Synth("thx",[\noteFinal,v+rrand(-0.1,0.1)]);
      });
    });
  }.play;
});
)

For notes less than middle C (midi note “60”) there are two voices created, and for the higher notes there are three voices with randomization added to their noteFinal.

Back to blog