forked from ccrma/webchuck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
249 lines (220 loc) · 10.8 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
<!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>
</head>
<body>
<!-- Animation -->
<div id="animationContainer"></div>
<!-- Hero -->
<div class="px-4 pt-0 my-5 text-center border-bottom">
<h1 class="display-4 fw-bold">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"
loading="lazy">
</a>
</div>
</h1>
<div class="col-lg-8 mx-auto">
<h2 class="lead mb-4"><em>ChucK => now on the Web</em></h2>
<p>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">
<div>
<button id="try" type="button" class="btn btn-success btn-md px-4 me-sm-3" disabled>Try WebChucK!</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">Explore WebChucK IDE! (new!)</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) and runs via
the <code>AudioWorkletNode</code> 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,
or shareable musical instruments! Check out the <a href="https://github.com/ccrma/webchuck"
target="_blank">GitHub</a> to learn more or contribute!</p>
<p>WebChucK powers <b>WebChucK IDE</b>: 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">Try WebChucK IDE! (new!)</button>
</a>
<br>
<br>
<p>Read more about WebChucK and WebChucK IDE:</p>
<div class="d-grid gap-2 d-sm-flex justify-content-sm-left mb-5">
<div style="margin-right: 10px;">
<a href="https://drive.google.com/file/d/1BbRtKw6y3q0CUppIq7cU4oE_A8RAGmWh/view" target="_blank">
<button type="button" class="btn btn-outline-secondary btn-md px-4">WebChucK paper (NIME 2023)</button>
</a>
</div>
<div style="margin-right: 10px;">
<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>
</a>
</div>
<div>
</div>
</div>
<!-- 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 JS 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';
document.getElementById('action').addEventListener('click', async () => {
// Initialize default ChucK object, if not already initialized
window.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> will be available as a global variable.</p>
<h4>NPM</h4>
<p>Install WebChucK via npm. WebChucK can also be used with 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 without a 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>
<h2 id="documentation">Documentation</h2>
<p>Getting Started Documentation Guide: <a href="./docs">here</a> </p>
<p>WebChucK full documentation and API reference <em>(communicating between JS and ChucK)</em>:</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>
<br>
<br>
<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>