On Wed, 27 Jan 2010 06:54:00 -0600 (CST)
"Gabriel M. Beddingfield" <gabrbedd(a)gmail.com> wrote:
On Wed, 27 Jan 2010, cal wrote:
Jens M Andreasen wrote:
[ ... ]
I am surprised that nobody so far has suggested using the key and
velocity as a "salt" to differentiate a single stream of randomness?
If you don't mind, how would one go about "salting" it?
One way that comes to mind:
unsigned short int note, velocity;
// ...
unsigned int salt = ((velocity & 0x7F)<<7) | (note & 0x7F);
struct random_data seed;
srandom_r(salt, &seed);
Thus, if you repeat the note with identical velocity...
you'll always get the same random-number sequence.
-gabriel
Hmmm,
Getting identical note and velocity is going to be quite common on
sequencer generated stuff, so I would have thought this was rather
undesirable. While there have been odd occasions when I've wished I
could reliably re-create a pseudo random sequence, in general I would
not want repeated identically created notes to sound exactly the same.
--
Will J Godfrey
http://www.musically.me.uk
Say you have a poem and I have a tune.
Exchange them and we can both have a poem, a tune, and a song.