waawhitenoisenode

A simple white noise for web audio API

Usage no npm install needed!

<script type="module">
  import waawhitenoisenode from 'https://cdn.skypack.dev/waawhitenoisenode';
</script>

README

WAAWhiteNoiseNode

A white noise node for Web audio API.

Note : The method used to generate noise is terrible (looping over a random buffer), and so the white noise really isn't one ... but that method is the only way at the moment to generate noise with native audio nodes.

Installation

You can grab the latest browser build from dist/ or install through npm with npm install waawhitenoise

Usage

Create :

var context = new AudioContext()
  , noiseNode = new WAAWhiteNoiseNode(context)

Connect :

// `WAAWhiteNoiseNode.connect` takes the same arguments as `AudioNode.connect`
noiseNode.connect(someOtherNode)

Start / Stop :

// Start at currentTime = 0.5 seconds
noiseNode.start(0.5)
// Stop at currentTime = 10 seconds
noiseNode.stop(0.5)

Build

npm run build

Run the tests

Run npm build.tests. It will create a waatest folder in the root of the package. Then open waatest/index.html in a web browser.