-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
291 lines (251 loc) · 12.5 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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>WebChucK</title>
<link rel="stylesheet" href="style.css">
<!-- Highlight.js -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/atom-one-dark.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>
<!-- JSZip -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js" integrity="sha512-XMVd28F1oH/O71fzwBnV7HucLxVwtxf26XV8P4wPk26EDxuGZ91N8bsOttmnomcCD3CS5ZMRL50H0GgOHvegtg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head>
<body>
<!-- Animation -->
<div id="animationContainer"></div>
<!-- Hero -->
<div class="px-4 pt-0 my-2 text-center border-bottom">
<h1 class="display-4 fw-bold mb-0">WebChucK
<div style="display: inline; height: auto; align-items: center;">
<a href="https://chuck.stanford.edu">
<img src="https://chuck.stanford.edu/doc/images/chuck-logo2023w.png" alt="ChucK logo" width="64" height="64">
</a>
</div>
</h1>
<div class="col-lg-8 mx-auto">
<h2 class="lead mb-1" style="margin-top: -.2rem"><em>ChucK => now on the Web</em></h2>
<small>ver. <a id="version-id" href="#">1.2.9</a>
<font size="1" color="orange"> — <b>new!!</b></font>
</small>
<p class="my-4">Web-based computer music programming with ChucK for online audiovisual experiences, web apps, musical
instruments and more! Take ChucK with you on the go!
</p>
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center mb-2 mt-2">
<div>
<button id="try" type="button" class="btn btn-success btn-md px-4 me-sm-3" disabled>Loading</button>
</div>
<div>
<a href="https://chuck.stanford.edu/ide" target="_blank">
<button type="button" class="btn btn-warning btn-md px-4 me-sm-3">Launch WebChucK IDE!</button>
</a>
</div>
</div>
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center mb-5">
<div style="margin-right: 10px;">
<a href="./docs/classes/Chuck.html" target="_blank">
<button type="button" class="btn btn-outline-secondary btn-md px-4">Read the Documentation</button>
</a>
</div>
</div>
</div>
<div class="overflow-hidden" style="max-height: 30vh;">
<div class="container px-5">
<img src="img/webchuck-dark.png" class="img-fluid border rounded-3 shadow-lg mb-4" alt="Example image"
width="700" height="500" loading="lazy">
</div>
</div>
</div>
<h2 id="webchuck">WebChucK</h2>
<p><a href="https://github.com/ccrma/webchuck" target="_blank">github</a> | <a
href="https://chuck.stanford.edu/webchuck/docs" target="_blank">docs</a>
| <a href="https://www.npmjs.com/package/webchuck" target="_blank">npm</a></p>
<p>WebChucK brings <a href="https://chuck.stanford.edu" target="_blank">ChucK</a>, the
strongly-timed audio programming language, to the web! ChucK’s C++
source code has been compiled with Emscripten to WebAssembly (WASM) to run via
the <a href="https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkletNode" target="_blank"><code>AudioWorkletNode</code></a> interface of the Web Audio API. With
near-native performance, WebChucK runs on modern desktop browsers as
well as tablets and mobile devices! Bring together ChucK’s real-time
sound synthesis engine and the interconnectivity of the web to create
new experiences and develop creative workflows. Embed WebChucK into any website to power
online audiovisual experiences, immersive multi-channel audio web apps,
shareable musical instruments, and more!
<p>WebChucK powers <a href="https://chuck.stanford.edu/ide" target="_blank">WebChucK IDE</a>,
an amazing web-based programming sandbox for ChucK!</p>
<a href="https://chuck.stanford.edu/ide">
<button type="button" class="btn btn-warning btn-md px-4 me-sm-3">Launch WebChucK IDE!</button>
</a>
<br>
<br>
<p>Read more about WebChucK and WebChucK IDE:</p>
<ul>
<li>
<a href="https://mcd.stanford.edu/publish/files/2023-nime-webchuck.pdf" target="_blank">
<!-- <button type="button" class="btn btn-outline-secondary btn-md px-4">WebChucK paper (NIME 2023)</button> -->
WebChucK: Computer Music Programming on the Web (NIME 2023)
</a>
</li>
<li>
<a href="https://ccrma.stanford.edu/~tzfeng/publish/2023-smc-webchuck-ide.pdf" target="_blank">
<!-- <button type="button" class="btn btn-outline-secondary btn-md px-4">WebChucK IDE paper (SMC 2023)</button> -->
WebChucK IDE: A Web-Based Programming Sandbox for ChucK (SMC 2023)
</a>
</li>
</ul>
<!-- Carousel -->
<h2>Featured Projects</h2>
<div class="container-fluid py-2">
<div class="d-flex flex-row flex-nowrap overflow-scroll">
<div class="card text-bg-dark">
<img src="img/terry-fb-delay.jpg" class="card-img-top" alt="Feedback Delay">
<div class="card-body">
<h5 class="card-title">Feedback Delay - Terry Feng</h5>
<p class="card-text">A stereo pitch-shift feedback delay effect for live improvisation performance and electronics.</p>
<a href="https://ccrma.stanford.edu/~tzfeng/projects/fbdelay/" class="btn btn-success" target="_blank">Explore</a>
</div>
</div>
<div class="card text-bg-dark">
<img src="img/terry-soundscapeai.jpg" class="card-img-top" alt="SoundscapeAI">
<div class="card-body">
<h5 class="card-title">SoundscapeAI - Terry Feng</h5>
<p class="card-text">Extract environmental sonic features for real-time ambient soundscape generation
with concatenative synthesis. Utilizes Chuck for AI (ChAI) tools.</p>
<a href="https://ccrma.stanford.edu/~tzfeng/356/hw2/" class="btn btn-success" target="_blank">Explore</a>
</div>
</div>
<div class="card text-bg-dark">
<img src="img/jack-timbre-library.jpg" class="card-img-top" alt="ChucK Timbre Library">
<div class="card-body">
<h5 class="card-title">Virtual Instrument Timbre Library - Jack Atherton</h5>
<p class="card-text">Connect a MIDI keyboard to play some web-based virtual synths. Jack’s Timbre Library
for ChucK provides several examples of web-based virtual synths in action.</p>
<a href="https://ccrma.stanford.edu/~lja/timbre-library/" class="btn btn-success"
target="_blank">Explore</a>
</div>
</div>
<div class="card text-bg-dark">
<img src="img/luna-chauvet.jpg" class="card-img-top" alt="Chauvet Cave Beep Ploc Symphony">
<div class="card-body">
<h5 class="card-title">Chauvet Cave Beep Ploc Symphony - Luna Valentin</h5>
<p class="card-text">A data sonification project examining the effect of increased extreme weather phenomena
on the ecological balance of caves in France, previously inhabited by our Paleolithic ancestors 36,000
years ago.</p>
<a href="https://ccrma.stanford.edu/~luna/220a/fp/" class="btn btn-success" target="_blank">Explore</a>
</div>
</div>
<div class="card text-bg-dark">
<img src="img/cole-image-sonifier.jpg" class="card-img-top" alt="Image Sonifier">
<div class="card-body">
<h5 class="card-title">Image Sonifier - Cole Simmons</h5>
<p class="card-text">An image-to-sound converter that uploads an image from the user, retrieves various
parameters like minimum and maximum hue and saturation, and sonifies the calculated data with WebChucK.
</p>
<a href="https://image-sonification.vercel.app/" class="btn btn-success" target="_blank">Explore</a>
</div>
</div>
<div class="card text-bg-dark">
<img src="img/josh-gutter-synthesis.jpg" class="card-img-top" alt="Gutter Synthesis">
<div class="card-body">
<h5 class="card-title">Barrel Synth - Josh Mitchell</h5>
<p class="card-text">A unique virtual instrument inspired by Tom Mudd’s Gutter Synthesis algorithm. A bank of
sliders lets you control the amount of feedback between a set of unruly chaotic oscillators.
</p>
<a href="https://ccrma.stanford.edu/~jomitch/220a/fp/" class="btn btn-success" target="_blank">Explore</a>
</div>
</div>
</div>
</div>
<h2 id="usage">Getting Started</h2>
<h4>CDN</h4>
<p>Embed WebChucK as a JavaScript module into your <code>index.html</code>.</p>
<div>
<pre><code class="language-html"><html>
<head>
<script type="module" defer>
import { Chuck } from 'https://cdn.jsdelivr.net/npm/webchuck/+esm';
let theChuck; // global variable
document.getElementById('action').addEventListener('click', async () => {
// Initialize default ChucK object
if (theChuck === undefined) {
theChuck = await Chuck.init([]);
}
// Run ChucK code
theChuck.runCode(`
SinOsc sin => dac;
440 => sin.freq;
1::second => now;
`);
});
</script>
</head>
<body>
<button id="action">Start and Play</button>
</body>
</html></code></pre>
</div>
<p><code>theChuck</code> contains the ChucK Virtual Machine for running code, removing shreds,
syncing global variables, and more! Read the
<a href="./docs/classes/Chuck.html" target="_blank">documentation</a>
for the full API reference.
</p>
<h4>NPM</h4>
<p>Install WebChucK via <a href="https://www.npmjs.com/package/webchuck" target="_blank">npm</a>. WebChucK also supports TypeScript.</p>
<pre><code class="language-bash">$ npm install webchuck</code></pre>
<div>
<pre><code>import { Chuck } from 'webchuck'
// Initialize default ChucK object
const theChuck = await Chuck.init([]);
// Run ChucK code
theChuck.runCode(`
SinOsc sin => dac;
440 => sin.freq;
1::second => now;
`);</code></pre>
</div>
<p>Note that many browsers do not let audio run until there has been user
interaction (e.g. button press). You can check for a suspended audio context and resume like this: </p>
<div>
<pre><code>if (theChuck.context.state === "suspended") {
theChuck.context.resume();
}</code></pre>
</div>
<div>
<h4>Download Source</h4>
<p>Download ready-to-use compiled <a href="#" id="downloadZip">WebChucK source files</a> (JS + WASM) as a zip.</p>
<button type="button" class="btn btn-warning btn-md px-2 me-sm-3" id="downloadZipButton">Download</button>
<p>Unzip the file and place the entire <code>webchuck</code> directory into your project.</p>
<div>
<pre><code>// Import the webchuck bundle from `webchuck` directory
import { Chuck } from './webchuck/wc-bundle.js'
// Set src path to './webchuck/'
const theChuck = await Chuck.init([], undefined, undefined, './webchuck/');
</code></pre>
</div>
<p>Note: All files must be served in order for WebChucK to run locally.</p>
<h2 id="documentation">Documentation</h2>
<p>Read the <a href="./docs">Getting Started</a> guide to set up your project.</p>
<p>Click below for full WebChucK API reference documentation (how to WebChucK & JavaScript):</p>
<a href="./docs/classes/Chuck.html">
<button type="button" class="btn btn-warning btn-md px-4 me-sm-3">Read the documentation</button>
</a>
<br>
<br>
<br>
<br>
<div class="px-4 pt-0 my-2 text-center border-top">
<p>View WebChucK source on <a href="https://github.com/ccrma/webchuck">GitHub</a></p>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
<!-- Bootstrap 5.3.0 -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz"
crossorigin="anonymous"></script>
<script src="main.js"></script>
</body>
</html>