ファイルの編集のテスト
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Web Audio API - test</title> | |
<script> | |
window.AudioContext = window.AudioContext || | |
window.webkitAudioContext || | |
window.mozAudioContext; |
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 vol = ctx.createGain(); | |
vol.gain.value = 0.2; // 0.0 - 1.0 | |
vol.connect(ctx.destination); | |
osc_freq = new Array(0, 262, 294, 330, 349, 392, 440); | |
melody = new Array( | |
1, 2, 3, 0, 1, 2, 3, 0, 5, 3, 2, 1, 2, 3, 2, 0, | |
1, 2, 3, 0, 1, 2, 3, 0, 5, 3, 2, 1, 2, 3, 1, 0, |
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 vol = ctx.createGain(); | |
vol.gain.value = 0.2; // 0.0 - 1.0 | |
vol.connect(ctx.destination); | |
osc = new Array(3); | |
osc_freq = new Array(262, 277, 330); | |
for(i=0; i<3; i++) { | |
osc[i] = ctx.createOscillator(); |
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); |
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'; | |
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); |