Skip to content

Instantly share code, notes, and snippets.

@corbanbrook
Created December 18, 2009 01:21
Show Gist options
  • Save corbanbrook/259191 to your computer and use it in GitHub Desktop.
Save corbanbrook/259191 to your computer and use it in GitHub Desktop.
var generateBaseSignal = function(frequency, bufferSize, sampleRate) {
var signal = [];
for(var i = 0; i < bufferSize; i++) {
var step = i * (frequency / sampleRate) % 1;
signal[i] = Math.sin(2*Math.PI * step);
//signal[i] = step < 0.5 ? 1 : -1;
}
return signal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment