Fill array or audio-buffer with defined type of noise.
let createNoise = require('audio-noise')
let noise = createNoise('pink')
//create array filled with pink noise
let arr = noise(Array(1024))
Create noise generator of specific color or based on options
.
Property | Default | Meaning |
---|---|---|
type , color |
'white' |
Color of noise. |
sampleRate |
44100 |
Output data sample rate. |
channels |
1 |
Output data number of channels. |
samplesPerFrame |
1024 |
Default length of the block. |
format |
'float32' |
Output data format, eg. 'uint8 interleaved' , 'float32 planar' , 'array' , 'audiobuffer' etc. See pcm-convert and audio-format for list of available formats. |
Value | Spectrum | Description |
---|---|---|
'white' |
Flat spectrum noise. See wiki. | |
'pink' |
-3dB/octave. See wiki. | |
'brown' |
-6dB/octave. See wiki. | |
'blue' |
TODO +3dB/octave. | |
'violet' |
TODO +6dB/octave. | |
'grey' |
TODO White noise weighted by loudness curve, see a-weighting. Also see wiki | |
'green' |
TODO |
Fill passed audio-buffer or array with noise. Buffer is modified in-place.
const write = require('web-audio-write')()
const noise = require('./')({color: 'white', format: 'stereo audiobuffer'})
;(function tick(err) {
if (err) throw err
write(noise(), tick)
})()
- pull-audio-noise − audio-noise pull-stream source
- audio-noise-stream − audio-noise readable node stream
- Colors of Noise − digest of colors of noise.
- white-noise-node, pink-noise-node, brown-noise-node − Web Audio API noise source nodes.
© 2017 Dmitry Yvanov @ audiojs. MIT License