Re: [LAD] random curiosity

From: Folderol <folderol@email-addr-hidden>
Date: Wed Jan 27 2010 - 16:37:47 EET

On Wed, 27 Jan 2010 06:54:00 -0600 (CST)
"Gabriel M. Beddingfield" <gabrbedd@email-addr-hidden> 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.
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Wed Jan 27 20:15:02 2010

This archive was generated by hypermail 2.1.8 : Wed Jan 27 2010 - 20:15:02 EET