Skip to content

Instantly share code, notes, and snippets.

@andrewn
Last active December 25, 2015 06:19
Show Gist options
  • Save andrewn/6931554 to your computer and use it in GitHub Desktop.
Save andrewn/6931554 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>The Pips</title>
</head>
<body>
<button onclick="pips()">The Pips</button>
<script src="pips.js"></script>
</body>
</html>
window.AudioContext = window.AudioContext||window.webkitAudioContext;
var context = new AudioContext();
function oscillator() {
var osc = context.createOscillator();
osc.frequency.value = 1000;
osc.connect(context.destination);
return osc;
}
function pip(start, length) {
var osc = oscillator();
osc.start(start);
osc.stop(start + length);
}
function pips() {
pip(1, 0.1);
pip(2, 0.1);
pip(3, 0.1);
pip(4, 0.1);
pip(5, 0.1);
pip(6, 0.5);
}
pips();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment