Displaying 1 result from an estimated 1 matches for "white_noise_rem".
2006 Apr 20
1
Ogg Vorbis questions
...em in the encoder? What do you think?
Also see:
http://www.turbocat.net/~hselasky/math/image_sound/
A white noise generator is as simple as this:
#define PRIME 0xffff1d /* a special prime number */
/* outputs 24-bit signed samples */
static int32_t
get_white_noise(void)
{
static u_int32_t white_noise_rem = 1;
u_int32_t temp;
if (white_noise_rem & 1) {
white_noise_rem += PRIME;
}
white_noise_rem /= 2;
temp = white_noise_rem;
temp ^= 0x800000; /* signed to unsigned conversion */
if(temp & 0x800000) {
temp |= (-0x800000); /* sign extension */
}...