Skip to content

Instantly share code, notes, and snippets.

@softpunch
Created July 2, 2017 22:49
Show Gist options
  • Save softpunch/57a65d8e3853d03230752a245304795c to your computer and use it in GitHub Desktop.
Save softpunch/57a65d8e3853d03230752a245304795c to your computer and use it in GitHub Desktop.
Web Audio Base (basic initialization)
// basic minimum initialization
window.AudioContext = window.AudioContext || window.webkitAudioContext;
var audioContext = new AudioContext();
// set latency hint
if ("latencyHint" in audioContext) {
audioContext.latencyHint = "playback";
};
var baseFreq = 440; // A4, Midi Note #69
var baseTempo = 120; // BPM
var audioOut = audioContext.destination;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment