packages/noise/README.md
<a name="module_noise"></a>
## noise
> Generate noise
[![npm install dsp-noise](https://nodei.co/npm/dsp-noise.png?mini=true)](https://npmjs.org/package/dsp-noise/)
**Example**
```js
const dsp = require('dsp-kit')
dsp.fill(1024, dsp.white())
```
* [noise](#module_noise)
* [.white([compensate])](#module_noise.white) ⇒ <code>function</code>
* [.pink([compensate])](#module_noise.pink) ⇒ <code>function</code>
* [.brown([compensate])](#module_noise.brown) ⇒ <code>function</code>
<a name="module_noise.white"></a>
### noise.white([compensate]) ⇒ <code>function</code>
Create a function that generates white noise
**Kind**: static method of <code>[noise](#module_noise)</code>
**Returns**: <code>function</code> - the white noise generator function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [compensate] | <code>Number</code> | <code>1</code> | the gain compensation |
**Example**
```js
var dsp = require('dsp-kit')
dsp.fill(1024, dsp.white())
```
<a name="module_noise.pink"></a>
### noise.pink([compensate]) ⇒ <code>function</code>
Create a function that generates pink noise
Pink noise has an even distribution of power if the frequency is mapped in a
logarithmic scale.
If 'white' consists of uniform random numbers, such as those generated by the
rand() function, 'pink' will have an almost gaussian level distribution.
This is an approximation to a -10dB/decade filter using a weighted sum of
first order filters. It is accurate to within +/-0.05dB above 9.2Hz (44100Hz
sampling rate). Unity gain is at Nyquist, but can be adjusted by scaling the
numbers at the end of each line.
It uses the Paul Kellet’s (refined) method: has smooth spectrum, but goes up
slightly at the far high end
#### References
- https://github.com/csound/csound/blob/develop/Opcodes/pitch.c#L1338
- http://www.musicdsp.org/files/pink.txt
**Kind**: static method of <code>[noise](#module_noise)</code>
**Returns**: <code>function</code> - the pink noise generator function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [compensate] | <code>Number</code> | <code>0.11</code> | The result will be multiplied by this constant in order to compensate the gain output |
**Example**
```js
var dsp = require('dsp-kit')
dsp.fill(1024, dsp.pink())
```
<a name="module_noise.brown"></a>
### noise.brown([compensate]) ⇒ <code>function</code>
Create a function that generates brown noise
**Kind**: static method of <code>[noise](#module_noise)</code>
**Returns**: <code>function</code> - the brown noise generator function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [compensate] | <code>Number</code> | <code>3.5</code> | the gain compensation value |
**Example**
```js
var dsp = require('dsp-kit')
dsp.fill(1024, dsp.brown())
```