Skip to content

Instantly share code, notes, and snippets.

@whichlight
Created May 3, 2013 02:13
Show Gist options
  • Select an option

  • Save whichlight/5506776 to your computer and use it in GitHub Desktop.

Select an option

Save whichlight/5506776 to your computer and use it in GitHub Desktop.
simple deep drone synth
s1 = get_synth(35);
s2 = get_synth(35.2);
function get_synth(pitch){
nodes={};
nodes.source = myAudioContext.createOscillator();
nodes.source.type=3;
nodes.filter = myAudioContext.createBiquadFilter();
nodes.volume = myAudioContext.createGainNode();
nodes.filter.type=0; //0 is a low pass filter
nodes.volume.gain.value = 0.5;
nodes.source.connect(nodes.filter);
nodes.filter.connect(nodes.volume);
nodes.volume.connect(myAudioContext.destination);
//pitch val
nodes.source.frequency.value=pitch;
//frequency val
nodes.filter.frequency.value=100;
nodes.source.noteOn(0);
return nodes
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment