Last active
December 25, 2015 06:19
-
-
Save andrewn/6931554 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>The Pips</title> | |
</head> | |
<body> | |
<button onclick="pips()">The Pips</button> | |
<script src="pips.js"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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