-
Notifications
You must be signed in to change notification settings - Fork 130
/
index.html
356 lines (265 loc) · 8.59 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
<!doctype html>
<html>
<head>
<!--Author: Ben Taylor -->
<title>Nexus Web Audio Interfaces</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1., user-scalable=no, width=device-width"/>
<link rel="icon" type="image/png" href="favicon.png" />
<!-- fonts -->
<link href="https://fonts.googleapis.com/css?family=Muli" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,600' rel='stylesheet' type='text/css'>
<!-- jquery links -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="api/js/Tone9.js"></script>
<!-- nexus links -->
<script type="text/javascript" src="dist/NexusUI.js"></script>
<link rel='stylesheet' href='api/prism/prism.css' />
<script src="api/prism/prism.js"></script>
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@suncanon">
<meta name="twitter:creator" content="@suncanon">
<meta name="twitter:title" content="NexusUI: Web Audio Interfaces">
<meta name="twitter:description" content="A JavaScript toolkit for building instruments in the browser.">
<meta name="twitter:image" content="https://nexus-js.github.io/ui/images/card.png">
</head>
<body>
<style>
body {
line-height:normal;
font-family:'Open Sans', helvetica neue;
}
.row {
max-width:none;
}
a {
color: rgb(20, 160, 170);
}
a:hover {
text-decoration:underline;
}
h1, h2, h3 {
font-family: "Muli", sans-serif;
font-weight: 300;
color:#333;
font-size:20pt;
display:block;
line-height:20pt;
padding:3px 0px;
margin:0px 0px;
}
h2 {
font-size:16pt;
}
h3 {
padding-top:0px;
font-size:13pt;
font-weight: 1000;
}
.codedisplay {
border:solid 0px #aaa;
outline:none;
background-color:#f7f7f7;
font-family: courier;
font-size:10pt;
color:#19b;
padding:20px !important;
border-radius:6px;
box-shadow:none;
-webkit-box-shadow:none;
resize:none;
width:100%;
}
textarea {
user-select:none;
-webkit-user-select:none;
-moz-user-select: none;
}
.dl {
border-radius:5px;
border:none;
font-weight:normal;
padding:10px 20px;
text-decoration:none;
cursor:pointer;
transition:0.2s;
display:inline-block;
margin:20px auto;
margin: 5px 10px 0px 0px;
padding:4px 20px;
border-radius:0px;
}
.dl-one, .dl-one:visited {
background-color: rgb(34, 187, 187);
color:white !important;
}
.dl-two, .dl-two:visited {
background-color:#ddd;
color:#000 !important;
}
.dl-one:hover {
background-color:rgb(34, 187, 187);
color:white;
text-decoration:none;
}
.dl-two:hover {
background-color:#ccc;
color:#111;
text-decoration:none;
}
button {
outline:none;
}
#column {
width:600px;
margin:50px auto;
}
@media screen and (max-width: 900px) {
#column {
width: auto;
padding:0px 40px;
}
}
</style>
<!-- general container -->
<div id="column">
<div style="overflow:auto;height:212px">
<h1>NexusUI</h1>
<h2>Web Audio Interfaces</h2><br>
<div id="demorack" style="margin-top:10px">
<div style="float:left">
<div nexus-ui="dial" id="demo2" style="width:80px;height:70px;margin-top:10px;"></div>
<div nexus-ui="number" id="demo3" style="width:50px;height:25px;margin:5px auto 0px;"></div>
</div>
<div nexus-ui="slider" id="demosl1" style="width:20px;height:100px;float:left;margin:10px 0px 0px 5px;"></div>
<div nexus-ui="slider" id="demosl2" style="width:20px;height:100px;float:left;margin:10px 0px 0px 5px;"></div>
<div nexus-ui="slider" id="demosl3" style="width:20px;height:100px;float:left;margin:10px 0px 0px 5px;"></div>
<div nexus-ui="sequencer" id="demo4" style="width:200px;height:100px;float:left;margin:10px 0px 0px 5px;"></div>
</div>
<script>
Nexus.context = Tone.context;
var rack1 = new Nexus.Rack("demorack")
rack1.demo3.link(rack1.demo2)
rack1.demosl1.value = 0.7
rack1.demosl2.value = 0.5
rack1.demosl3.value = 0.3
rack1.demo2.value = 0.5
rack1.demo4.columns = 10;
rack1.demo4.matrix.set.all([
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,1,0,0,0,0,1,0],
[0,0,1,0,1,0,0,1,0,1],
[1,0,0,0,0,1,0,0,0,0]
])
rack1.demo4.start();
</script>
</div>
<div style="clear:both;margin:40px 0px 0px;">
<p class="overview">
NexusUI is a collection of HTML5 interfaces and Javascript helper functions to assist with building web audio instruments in the browser.
</p>
<p class="overview">
In addition to interfaces, it offers a few helper methods for <b>tuning</b> and <b>timing</b>.
It does not provide any sound-making capabilities –– for that, check out the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API" target="blank">Web Audio API</a> or web audio libraries such as <a href="http://tonejs.github.io" target="blank">Tone.js</a>, <a href="https://github.com/sebpiq/WebPd" target="blank">WebPD</a>, or <a href="https://github.com/charlieroberts/gibber.audio.lib" target="blank">Gibber</a>.
</p>
<div style="margin:40px auto 40px;">
<a class="dl dl-one" href="api/">Documentation</a>
<a class="dl dl-two" href="https://github.com/nexus-js/ui/">View on Github</a>
</div>
</div>
<hr />
<div style="margin:25px 0px;" id="example">
<b>Example</b><br />
<br />
<button id="mobileStart" style="display:none;width:200px;margin:5px 3px;">Press to Initialize Mobile Audio</button>
<!-- result goes here -->
<div id="power" style="width:40px;height:17px;margin:15px 0px;"></div>
<div id="volume" style="width:200px;height:20px;margin:5px 3px;"></div>
<script>
var power = new Nexus.Toggle("#power");
var gain = new Nexus.Slider("#volume");
// Create a sound source using Tone.js
var volume = new Tone.Volume(-Infinity).toMaster();
var synth = new Tone.Oscillator(300,"sine").connect(volume);
// Add event listeners
power.on('change',function(value) {
value ? synth.start() : synth.stop();
});
gain.on('change',function(value) {
volume.volume.rampTo(value,.1)
});
gain.min = -100
gain.max = 0
gain.value = -30
</script>
<br /><br />
HTML
<pre class="codedisplay language-html"><code><div id="power"><div>
<div id="gain"><div></code></pre>
<br /><br />
JS
<pre class="codedisplay language-javascript"><code>// Create interfaces
var power = new Nexus.Toggle("#power");
var gain = new Nexus.Slider("#gain");
// Create a sound source
var volume = new Tone.Volume(-Infinity).toMaster();
var synth = new Tone.Oscillator(300,"sine").connect(volume);
// Listen for interface events
power.on('change',function(v) {
v ? synth.start() : synth.stop();
});
gain.on('change',function(v) {
volume.volume.rampTo(v,.1)
});
gain.min = -100;
gain.max = 0;
gain.value = -30;</code></pre>
<!-- <br /><br />
CSS
<pre class="codedisplay language-css"><code>#power {
width:40px;
height:17px;
margin:15px 0px;
}
#echo {
width:200px;
height:20px;
margin:5px 3px;
}</code></pre>
-->
</div>
<br>
<hr />
<div style="margin:25px 0px 25px;">
<b>Support</b><br /><br />
NexusUI is an open-source project which is maintained in my spare time. If you enjoy NexusUI, please considering supporting its continued development and keeping it open-source.<br><br>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_donations" />
<input type="hidden" name="business" value="KTKBDBXH39L6U" />
<input type="hidden" name="currency_code" value="USD" />
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
</form>
</div>
</div>
<!-- FOOTER -->
<div style="font-size:10pt;color:#aaa;padding:30px;text-align:center;margin-top:20px;background-color:#eee;">
<div style="font-size:35pt;margin:5px auto 20px;color:#dadada;width:100px;text-align:center;">©</div>
experimental music & digital media @ louisiana state univeristy 2013-2016<br />
ben taylor 2017-2019
</div>
<script>
Prism.highlightAll();
</script>
<!-- GOOGLE ANALYTICS -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-42209714-2', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>