Last active
December 30, 2015 14:19
-
-
Save yo-to/7841377 to your computer and use it in GitHub Desktop.
Mac用 Firefox 25.0.1 のスクラッチパッドで音を鳴らす
(矩形波、周波数 330Hz)
This file contains 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
var ctx = new AudioContext(); | |
var osc = ctx.createOscillator(); | |
osc.type = 'square'; | |
osc.frequency.value = 330; | |
var vol = ctx.createGain(); | |
vol.gain.value = 0.2; // 0.0 - 1.0 | |
osc.connect(vol); | |
vol.connect(ctx.destination); | |
osc.start(0); | |
osc.stop(1.5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment