Skip to content

Instantly share code, notes, and snippets.

@bklimt
Created February 24, 2013 01:01
Show Gist options
  • Save bklimt/5022125 to your computer and use it in GitHub Desktop.
Save bklimt/5022125 to your computer and use it in GitHub Desktop.
Generate C# from JavaScript
var sineWave = function(frequency) {
var writer = new WaveWriter(2.0, 11025, 8);
var time = 0;
var sample = 0;
do {
sample = Math.sin(frequency * time * 2 * 3.14159);
time = time + 1/11025;
} while (writer.writeSample(sample));
writer.close();
return writer.buffer();
};
var middleCSharp = function() {
return sineWave(277.183);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment