view on requirebin
Created
July 18, 2013 18:48
-
-
Save nick-thompson/6031883 to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var context = new webkitAudioContext() | |
, node = context.createOscillator() | |
, Overdrive = require("wa-overdrive") | |
, overdrive = new Overdrive(context, { | |
preBand: 1.0, | |
color: 4000, | |
drive: 0.8, | |
postCut: 8000 | |
}); | |
node.connect(overdrive.input); | |
overdrive.connect(context.destination); | |
node.start(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=function(e,t,n){function a(n,i){if(!t[n]){if(!e[n]){var u="function"==typeof require&&require;if(!i&&u)return u(n,!0);if(r)return r(n,!0);throw Error("Cannot find module '"+n+"'")}var s=t[n]={exports:{}};e[n][0].call(s.exports,function(t){var r=e[n][1][t];return a(r?r:t)},s,s.exports)}return t[n].exports}for(var r="function"==typeof require&&require,i=0;n.length>i;i++)a(n[i]);return a}({"wa-overdrive":[function(e,t){t.exports=e("MG8ouw")},{}],MG8ouw:[function(e,t){function n(e,t){this.input=e.createGain(),this.output=e.createGain(),this._bandpass=e.createBiquadFilter(),this._bpWet=e.createGain(),this._bpDry=e.createGain(),this._ws=e.createWaveShaper(),this._lowpass=e.createBiquadFilter(),this.input.connect(this._bandpass),this._bandpass.connect(this._bpWet),this._bandpass.connect(this._bpDry),this._bpWet.connect(this._ws),this._bpDry.connect(this._ws),this._ws.connect(this._lowpass),this._lowpass.connect(this.output);var n=this.meta.params;t=t||{},this._bandpass.frequency.value=t.color||n.color.defaultValue,this._bpWet.gain.value=t.preBand||n.preBand.defaultValue,this._lowpass.frequency.value=t.postCut||n.postCut.defaultValue,this.drive=t.drive||n.drive.defaultValue,this._bpDry.gain.value=t.preBand?1-t.preBand:1-n.preBand.defaultValue}n.prototype=Object.create(null,{connect:{value:function(e){this.output.connect(e.input?e.input:e)}},disconnect:{value:function(){this.output.disconnect()}},meta:{value:{name:"Overdrive",params:{preBand:{min:0,max:1,defaultValue:.5,type:"float"},color:{min:0,max:22050,defaultValue:800,type:"float"},drive:{min:0,max:1,defaultValue:.5,type:"float"},postCut:{min:0,max:22050,defaultValue:3e3,type:"float"}}}},preBand:{enumerable:!0,get:function(){return this._bpWet.gain.value},set:function(e){this._bpWet.gain.setValueAtTime(e,0),this._bpDry.gain.setValueAtTime(1-e,0)}},color:{enumerable:!0,get:function(){return this._bandpass.frequency.value},set:function(e){this._bandpass.frequency.setValueAtTime(e,0)}},drive:{enumerable:!0,get:function(){return this._drive},set:function(e){var t=100*e,n=22050,a=new Float32Array(n),r=Math.PI/180;this._drive=e;for(var i=0;n>i;i++){var u=2*i/n-1;a[i]=20*(3+t)*u*r/(Math.PI+t*Math.abs(u))}this._ws.curve=a}},postCut:{enumerable:!0,get:function(){return this._lowpass.frequency.value},set:function(e){this._lowpass.frequency.setValueAtTime(e,0)}}}),t.exports=n},{}]},{},[]);var context=new webkitAudioContext,node=context.createOscillator(),Overdrive=require("wa-overdrive"),overdrive=new Overdrive(context,{preBand:1,color:4e3,drive:.8,postCut:8e3});node.connect(overdrive.input),overdrive.connect(context.destination),node.start(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; } | |
body, html { height: 100%; width: 100%; }</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment