PortAudio: paex_pink.c File Reference

PortAudio 2.0

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Functions | Variables
paex_pink.c File Reference
Example programs demonstrating PortAudio usage

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.