Skip to content
This repository has been archived by the owner on Sep 22, 2021. It is now read-only.

scrapjs/audio-noise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

audio-noise Build Status experimental

Fill array or audio-buffer with defined type of noise.

$ npm install audio-noise

let createNoise = require('audio-noise')

let noise = createNoise('pink')

//create array filled with pink noise
let arr = noise(Array(1024))

createNoise(color|options?)

Create noise generator of specific color or based on options.

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.

color or options.color

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

noise(target|length?)

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)
})()

Related

See also

License

© 2017 Dmitry Yvanov @ audiojs. MIT License

Releases

No releases published

Packages

No packages published