[Stk] Creating a THX-like sound

SatelliteBiker satellitebiker@gmail.com
Fri, 5 Jan 2007 12:27:24 -0600


Hi all,

Some time ago I read an interview with the person who created the THX
sound logo,
and his use of a dedicated audio computer to generate the sound. It's
an interesting read.
Found it: http://musicthing.blogspot.com/2005/05/tiny-music-makers-pt-3-thx-sound.html

The idea of shifting the tones in the THX sound looked like a fun problem,
but I couldn't get my code to work well. I found STK the other day and it
made this problem much easier.

What I've done is create a number of Bowed instruments wrapped in a "Cello"
class (a better name might be ShiftingBowed or something). The Cello class
maintains the initial and target frequencies, shift times and various
other random data, and as ticks increase the values are adjusted. The code
currently only uses 8 Bowed objects, not the 30 used in the real THX.
The code accepts one command line argument, an integer, which is the
random number seed for repeatable generations. The code runs for about
four seconds (on a Macbook Pro) to generate the 13 second wav file.

As for the actual sound, the Bowed instruments randomly start within the
first 1/4 second of the sound, shift their frequencies to their assigned targets
over five seconds, and hold the final chord until the 10-second mark. The
reverb gives a ringing finish for a few seconds.

All that said, don't expect this example to sound anywhere near as good
as the real THX logo. Source code and one sound example are available at:
  http://www.relro.net/audio/genthx1.cpp
  http://www.relro.net/audio/thx.wav (2.2MB)

I have lots of questions about STK that I couldn't find in the mail archive
or class documentation:

Easy questions:
* What values are valid for the various amplitude, rate, velocity, etc
parameters to
the Bowed class?
* Are sample values from STK instruments always within [-1, 1]?
* To mix several instruments, is a simple weighted sum of the samples
the idea? (And
adjust the weights to keep the sum in [-1, 1]?)
* When adding to a SineWave's phase, is the value in radians or a unit
of time/samples?
* In non-RT code, is it better to call the noteOn()/noteOff() methods
of Bowed, or
the start/stopBowing() methods?

Bigger questions:
* How can I get a better sound out of the Bowed instrument? What parameters
produce more of a bass sound (or cello, or violin)? Along those lines, would a
"bow position" of 0.5 produce louder fundamentals than harmonics?

* I'd like to use a sampled cello sound. If I use a WaveLoop with the
example sound sampled at 44.1khz, how much of that clip is needed? What
are the rules of thumb to using a fixed sample w.r.t to generating a different
frequency?

* Is there a STK class (or combination of classes) to generate an N-harmonic
sound wave? Instead of using a cello WaveLoop, maybe combine SineWaves
at the desired harmonics? Maybe another, more efficient method?

Thanks for STK. It's a neat library.
-Brent Burton

p.s. I welcome all comments and suggestions for improving this sound, from
instrument selection to final chord.