PortAudio  2.0
Data Structures | Macros | Functions | Variables

Generate Pink Noise using Gardner method. More...

#include <stdio.h>
#include <math.h>
#include "portaudio.h"

Go to the source code of this file.

Data Structures

struct  PinkNoise
 
struct  paTestData
 

Macros

#define PINK_MAX_RANDOM_ROWS   (30)
 
#define PINK_RANDOM_BITS   (24)
 
#define PINK_RANDOM_SHIFT   ((sizeof(long)*8)-PINK_RANDOM_BITS)
 
#define PINK_MEASURE
 
#define PINK_TEST
 

Functions

void InitializePinkNoise (PinkNoise *pink, int numRows)
 
float GeneratePinkNoise (PinkNoise *pink)
 
int main (void)
 

Variables

float pinkMax = -999.0
 
float pinkMin = 999.0
 

Detailed Description

Generate Pink Noise using Gardner method.

Optimization suggested by James McCartney uses a tree
to select which random value to replace.
    x x x x x x x x x x x x x x x x
    x   x   x   x   x   x   x   x
    x       x       x       x
     x               x
       x

Tree is generated by counting trailing zeros in an increasing index. When the index is zero, no random number is selected.

Author
Phil Burk http://www.softsynth.com

Definition in file paex_pink.c.