-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
133 lines (94 loc) · 2.44 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<html>
<head>
<meta charset="utf-8">
<meta name="Description" CONTENT="A simple page and site that plays a tone at 440 hz, also known as A 440">
<title>A-440</title>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="assets/js/buffer-loader.js"></script>
<script type="text/javascript">
/*
Thanks to Boris @ http://www.html5rocks.com/en/tutorials/webaudio/intro/ !
*/
$(document).ready(function(){
var context;
var bufferLoader;
var playing = false;
window.AudioContext = window.AudioContext || window.webkitAudioContext;
context = new AudioContext();
var oscillator = context.createOscillator();
oscillator.connect(context.destination);
oscillator.frequency.value = 440;
oscillator.detune.value = 0;
oscillator.type = oscillator.SINE;
oscillator.start(0);
playing = true;
$('.play').hide();
$('.play,.stop').click( function() {
$('.play,.stop').toggle();
if(playing == true){
oscillator.stop(0);
playing = false;
}
else {
oscillator = context.createOscillator();
oscillator.connect(context.destination);
oscillator.frequency.value = 440;
oscillator.detune.value = 0;
oscillator.type = oscillator.SINE;
oscillator.start(0);
playing = true;
}
});
}); //end document.ready(...)
</script>
<style type="text/css">
body {
background-color: #fff
}
.play {
width: 600px;
height: 600px;
cursor: hand;
background-image: url('assets/img/play.png');
background-repeat: no-repeat;
background-size:contain;
background-position:center;
}
.stop {
width: 600px;
height: 600px;
cursor: hand;
background-image: url('assets/img/stop.png');
background-repeat: no-repeat;
background-size: contain;
background-position:center;
}
.canvas {
width: 100%;
height: auto;
bottom: 0px;
top: 0px;
left: 0;
position: absolute;
}
.center {
font-family: 'Over the Rainbow';
font-size: 24em;
position: fixed;
border: 0px ridge gray;
top: 40%;
left: 60%;
margin-top: -200px;
margin-left: -400px;
}
</style>
</head>
<body>
<div id="container" class="canvas">
<div class="play center"></div>
<div class="stop center"></div>
</div>
</body>
</html>