Skip to content

Instantly share code, notes, and snippets.

@yuxel
Created December 4, 2013 22:44
Show Gist options
  • Save yuxel/7796978 to your computer and use it in GitHub Desktop.
Save yuxel/7796978 to your computer and use it in GitHub Desktop.
walle.js
var WallE = function () {
var context = new webkitAudioContext();
this.osc = context.createOscillator();
this.analyser = context.createAnalyser();
this.osc.connect(this.analyser);
this.analyser.connect(context.destination);
this.osc.start(0);
};
WallE.prototype.talk = function () {
var that = this;
setTimeout(function () {
that.osc.frequency.value = parseInt(Math.random() * 500, 10);
that.talk();
}, parseInt(Math.random() * 2000, 10))
};
var wallE = new WallE();
wallE.talk();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment