• Stars
    star
    114
  • Rank 306,295 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 11 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Noise generators for the Web Audio API.

noise.js

noise.js is a library that provides noise generators for the Web Audio API. Currently, noise.js provides generators for white noise, pink noise, and brown noise.

Read the post on Noisehack for details and a simple demo.

Here's a more advanced demo demonstrating both noise modulating oscillators and oscillators modulating noise.

Usage

White Noise

Create a white noise generator and route it to the output:

var context = new webkitAudioContext();
var whiteNoise = context.createWhiteNoise();
whiteNoise.connect(context.destination);

Pink Noise

Create a pink noise generator and route it to the output:

var context = new webkitAudioContext();
var pinkNoise = context.createPinkNoise();
pinkNoise.connect(context.destination);

Modulate a sawtooth oscillator with filtered pink noise:

var context = new webkitAudioContext();
var pinkNoise = context.createPinkNoise();
var pinkGain = context.createGainNode();
var pinkFilter = context.createBiquadFilter();
pinkGain.gain.value = 100;
pinkFilter.frequency.value = 1.618;
pinkNoise.connect(pinkFilter);
pinkFilter.connect(pinkGain);

var saw = context.createOscillator();
saw.type = saw.SAWTOOTH;
saw.frequency.value = 440.0;
var sawGain = context.createGainNode();
sawGain.gain.value = 0.3;

saw.start(0);
saw.connect(sawGain);
pinkGain.connect(saw.frequency);
sawGain.connect(context.destination);

Brown Noise

Create a brown noise generator and route it to the output:

var context = new webkitAudioContext();
var brownNoise = context.createBrownNoise();
brownNoise.connect(context.destination);

Modulate the brown noise amplitude to simulate the sound of the ocean:

var context = new webkitAudioContext();
var brownNoise = context.createBrownNoise();
var brownGain = context.createGainNode();
brownGain.gain.value = 0.3;
brownNoise.connect(brownGain);

var lfo = context.createOscillator();
lfo.frequency.value = 0.1;
var lfoGain = context.createGainNode();
lfoGain.gain.value = 0.1;

lfo.start(0);
lfo.connect(lfoGain);
lfoGain.connect(brownGain.gain);
brownGain.connect(context.destination);

More Repositories

1

wavebender

Audio synthesis in Python.
Python
208
star
2

euler

Project Euler solutions in Python, Haskell, Ruby, Rust, and more.
Python
149
star
3

750words

Write 750 words daily with your favorite editor in git
Python
44
star
4

hackernews

A Hacker News web app inspired by BaconReader.
JavaScript
30
star
5

monotron

The Korg Monotron synthesizer in JavaScript.
CSS
28
star
6

scissor

Web Audio API supersaw synthesizer.
JavaScript
26
star
7

city

Generative art based on @mrdoob's procedural city map generator.
JavaScript
8
star
8

zaum

Spaced repetition language learning built with Meteor.
JavaScript
6
star
9

zach.se

Source code for my blog.
JavaScript
6
star
10

noisehack

A blog about audio programming.
CSS
5
star
11

mandelbro

Interactive music visualizer built with WebGL and Web Audio.
C
4
star
12

autoblog

Content syndication system using Python and Jekyll.
JavaScript
3
star
13

shader-school-solutions

Solutions for https://github.com/stackgl/shader-school
GLSL
3
star
14

labyrinth.js

Maze algorithms in JavaScript.
JavaScript
3
star
15

bard

A module which generates pseudorandom text.
Python
3
star
16

algorhythm

Compose music with algorithms, in your web browser.
JavaScript
3
star
17

wikireader

Command line wikipedia reader optimized for speed and simplicity.
Python
3
star
18

rtchallenge

A Rust implementation of The Ray Tracer Challenge.
Rust
3
star
19

synapse

A subtractive synthesizer that runs in your browser.
JavaScript
2
star
20

aichallenge-ants

2011 AI Challenge (ants)
Java
1
star
21

facebook-liberation

Export all Facebook contact data from the Facebook app on Android.
Python
1
star
22

blenderfiles

Source code for blenderfiles.org
Ruby
1
star
23

labs.zacharydenton.com

Web experiments (primarily fractals + demo effects).
JavaScript
1
star
24

dotfiles

Shell
1
star
25

webgl-workshop-solutions

Solutions for https://github.com/stackgl/webgl-workshop
JavaScript
1
star
26

e23a

Introduction to Game Development produced by CS50
Lua
1
star
27

calibre-import

Import ebooks into calibre from the command line
Python
1
star
28

hamr

CSS
1
star