[chuck-users] MAUI Window Shooting Game
signal.automatique at gmail.com
Fri Jul 17 15:03:46 EDT 2009
> Kas - being a music novice, I don't know what polyphony is.
It's a fancy word for "more than one sound at a time". For example hitting a
chord (several keys at the same time) on a piano would be a case of
polyphony, as would a game that would let the sounds of a shot's ricochet
continue while the next shot is fired (and makes a sound).
> I just modified your code until it made a one-shot. The only thing is, it
> doesn't quit for some reason - once you fire your first shot you get sound
> for the rest of the game. That's a good thing for the game because it keeps
> the tension level up, but I don't understand why it does that.
Well, the actual sound comes from the Subnoise. The Subnoise stays connected
to the dac so you keep hearing it. The sound effect is caused by resetting
the random seed, thus re-starting the series of numbers the ranndom number
generator gives us but this is more or less like a modulation on the
To put it simply; A random number generator generates a train of numbers by
taking the last one it generated, applying some function (say a
multiplication, a addition, then a modulo) and returning that as well as
using it as the start for the next calculation. These functions are designed
to yield very long trains of numbers before they repeat. The first number
(the one we start with) is called the "seed". You may notice that when we
say "random" here what we actually mean is "very hard to predict", this is
good enough, unless you are starting a bank or running from the government
or something along those lines. We can set these seeds in programs like
ChucK to allow us to create random compositions that can still be repeated;
some composers find that important.
In this particular case Subnoise needs a random value every Nth sample to
generate it's noise. When we keep resetting the seed Subnoise will keep
repeating the same series of values, yielding a preceived tone when our ears
pick up on the structure. When we then start increasing the period at which
we reset the seed we also increase the length of the train of samples that
Subnoise plays, thus creating a perceived downwards modulation in pitch.
This is similar to filling a LiSa with noise, setting a very short loop and
while keeping the rate static increasing the loop's length.
In this particular case when you want silence you will need a ADSR or
similar between the Subnoise and the DAC as stopping the modulation doesn't
stop the sound.
I hope that makes it all clear; the trick is in the implicid link between
the random generator and some UGens that use it. You may now want to re-read
my notes on that exampe with the Flute again; it should now be clear.
Hopefully you'll then see why I mentioned polyphony above. If it's still
unclear we can go over that as well.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the chuck-users