forked from SthephanShinkufag/bytebeat-composer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
322 lines (318 loc) · 18.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Bytebeat player with a collection of many formulas from around the internet; Chasyxx fork">
<title id="TAB-NAME">CHYX Composer</title>
<link rel="canonical" href="https://chasyxx.github.io/EnBeat_NEW"/>
<link rel="shortcut icon" href="./favicon.png">
<link rel="stylesheet" type="text/css" href="bytebeat.css?version=2023022000">
<link rel="modulepreload" href="./scripts/audioProcessor.mjs?version=2023022000">
<script type="module" async src="./scripts/bytebeat.mjs?version=2023022000"></script>
<script type="module" async src="menus.js"></script>
</head>
<body>
<!--p align="center" style="color: #FFFF00; font-size: 12px">This is not the dollChan player! That's <a href="https://dollchan.net/bytebeat/">this one.</a><br />Still, credit to SthephanShi for making the original site!</p>
<p id="splash" align="center" style="color: #00FFFF; font-size: 12px">MissingNo, but it's <i>true!</i></p-->
<div id="log"></div>
<main id="content">
<section id="container-fixed">
<div id="editor-container">
<textarea id="editor-default" spellcheck="false">a="CHASYXX Bytebeat composer",aa=a.charCodeAt((((t&t>>14)&7)+t*(t>>11&7^t>>10&3))%(a.length)),
b="by Chase T",bb=b.charCodeAt((((t&t>>17)&7)+t*(t>>12&7^t>>10&7))%(b.length)),
c="Fork of StephanShi's player" ,cc=c.charCodeAt(((t&t>>20)+((t*1.07)>>2)*(t>>13&7^t>>10&15))%(c.length)),
((aa+bb+cc)/2)|t>>4</textarea>
</div>
<dialog id="code-is-already-minibaked">
<p>Code is already minibaked.</p>
<div style="display: flex; justify-content: center;"><button id="dialog-close">OK</button></div>
</dialog>
<dialog id="are-you-sure">
<p>Are you sure you want to remove this favorite?</p>
<div style="display: flex; justify-content: center;"><button id="dialog-yes">Yes</button><button id="dialog-no">No</button></div>
</dialog>
<div class="controls" id="controls0">
<div class="controls-group controls-grow">
<button id="control-counter-units" class="control-button" title="Time units">t</button>
<input type="text" id="control-counter" value="0" title="Set time to jump along the timeline then press Enter">
</div>
<div class="controls-group">
<button id="control-stop" class="control-button" title="Stop and reset">
<svg><use xlink:href="#symbol-stop"></use></svg>
</button>
<button id="control-reset" class="control-button" title="Reset time to 0">
<svg><use xlink:href="#symbol-reset"></use></svg>
</button>
</div>
<div class="controls-group">
<button id="control-play-backward" class="control-button control-play" title="Play reverse">
<span class="control-fast-multiplier">1</span>
<svg class="svg-fast"><use xlink:href="#symbol-fast"></use></svg>
<svg class="svg-play"><use xlink:href="#symbol-play"></use></svg>
</button>
<button id="control-pause" class="control-button" title="Pause">
<svg><use xlink:href="#symbol-pause"></use></svg>
</button>
<button id="control-play-forward" class="control-button control-play" title="Play forward">
<span class="control-fast-multiplier">1</span>
<svg class="svg-fast"><use xlink:href="#symbol-fast"></use></svg>
<svg class="svg-play"><use xlink:href="#symbol-play"></use></svg>
</button>
</div>
<div class="controls-group">
<button id="control-scaledown" class="control-button" title="Zoom in the scope">
<svg><use xlink:href="#symbol-scaledown"></use></svg>
</button>
<div id ="scale-indicator" class="control-indicator tube text-padding">N/A</div>
<button id="control-scaleup" class="control-button" title="Zoom out the scope">
<svg><use xlink:href="#symbol-scaleup"></use></svg>
</button>
</div>
<select id="control-drawmode" class="control-select controls-grow" title="Drawing mode">
<option class="song-options" value="Points" selected>Points</option>
<option class="song-options" value="Waveform" >Waveform</option>
<option class="song-options" value="Diagram" >Diagram</option>
</select>
<div class="controls-group">
<button id="control-rec" class="control-button" title="Record to the file">
<svg><use xlink:href="#symbol-rec"></use></svg>
</button>
<button id="control-link" class="control-button" title="Copy the song link">
<svg><use xlink:href="#symbol-link"></use></svg>
</button>
<button id="control-expand" class="control-button" title="Expand the code editor">
<svg><use xlink:href="#symbol-expand"></use></svg>
</button>
<span id="control-codesize" title="Code size in characters"></span>
</div>
<div class="controls-group controls-grow">
<input id="control-volume" type="range" min="0" max="1" value=".5" step="any" title="Volume">
</div>
<select id="control-menu-select" class="control-select" title="Control menus" onchange="MAT.changeMenu(this.value)">
<option class="song-options" value="1" title="MODE, SAMPLERATE, DIVISOR" selected>MENU 1 - SONG OPTIONS</option>
<option class="song-options" value="2">MENU 2 - TRANSFORMATIONS</option>
<option class="song-options" value="3">MENU 3 - DETAILS</option>
<!--option value="2" title="MENU 2- TEST">MENU 2 - TEST</option-->
</select>
</div>
<div class="controls" id="controls1">
<select id="control-mode" class="control-select controls-grow" title="Sound mode">
<option class="song-options" value="Bytebeat" selected>Bytebeat</option>
<option class="song-options" value="Signed Bytebeat">Signed Bytebeat</option>
<option class="song-options" value="Floatbeat">Floatbeat</option>
<option class="song-options" value="Bitbeat" title=""&1" view of code. Exotic mode.">Bitbeat</option>
<option class="song-options" value="2048" title="Wraps around at 2048 instead of 256. Exotic mode.">2048</option>
<option class="song-options" value="logmode" title=""log2()*32" view of code. Exotic mode.">Logmode</option>
<option class="song-options" value="logHack" title="Logmode, but suppourts negative numbers.">LogHack</option>
<option class="song-options" value="logHack2" title="LogHack, but 128 added. Multiplies by 16 instead. Especially exotic with numbers from -1 to 1.">LogHack2</option>
</select>
<div class="controls-group controls-grow">
<input type="text" id="control-samplerate" title="Set sample rate (in Hz) then press Enter">
<select id="control-samplerate-select" class="control-select" title="Sample rate">
<option value="8000" class="song-options">8000Hz</option>
<option value="11025" class="song-options">11025Hz</option>
<option value="16000" class="song-options">16000Hz</option>
<option value="22050" class="song-options">22025Hz</option>
<option value="32000" class="song-options">32000Hz</option>
<option value="44100" class="song-options">44100Hz</option>
<option value="48000" class="song-options">48000Hz</option>
</select>
</div>
<div class="controls-group controls-grow" width="128">
<input value="1" type="number" id="control-divisor" title="Set sample rate divisor then press Enter">
</div>
<button class="control-button text-padding" title="Formats code based off of commas and semicolons" onclick="MAT.commaFormat(false)">
FORMAT , and ;
</button>
</div>
<div class="controls hidden" id="controls2">
<div class="controls-group">
<input onchange="MAT.setParens(this.value)" type="number" id="control-parens" title="Maximum parentesies layers the Formatter will formatt" value="0">
</div>
<button id="control-format" class="control-button text-padding" title="Formats code based off of commas and semicolons" onclick="MAT.commaFormat(false)">
FORMAT , and ;
</button>
<button id="control-minibake" class="control-button text-padding dark" title="Minibakes code" onclick="MAT.bake()">
Minibake code
</button>
<button id="control-deminibake" class="control-button text-padding light" title="Deminibakes code" onclick="MAT.debake()">
Deminibake code
</button>
</div>
<div class="controls hidden" id="controls3">
<input type="checkbox" onchange="MAT.switch(this.checked)">Toggle extra library buttons
</div>
<div id="error"></div>
<div id="canvas-container" title="Click to play">
<canvas id="canvas-main" width="1024" height="256"></canvas>
<div id="canvas-timecursor"></div>
<div id="canvas-play" class="canvas-initial canvas-play">
<svg id="svg-canvas-play"><use xlink:href="#symbol-play"></use></svg>
<svg id="svg-canvas-pause"><use xlink:href="#symbol-pause"></use></svg>
</div>
</div>
</section>
<section id="container-scroll">
<details class="library-content">
<summary class="library-header">
<h1>Info — about bytebeat</h1>
</summary>
<article id="info" class="library-container entry-top">
Bytebeat music (or one-liner music) was invented in September 2011.
They're generally a piece of rhythmic and somewhat melodic music with no score, no instruments, and no real oscillators.
It's simply a single-line formula that defines a waveform as a function of time, processed (usually) 8000 times per second, resulting in an audible waveform with a 256-step resolution from silence (0) to full amplitude (256).
If you put that formula into a program with a loop that increments time variable (t), you can generate the headerless unsigned 8 bit mono 8kHz audio stream on output, like in this application.
Since these directly output a waveform, they have great performance in compiled languages and can often be ran on even the weakest embedded devices.<br />
<a href="http://canonical.org/~kragen/bytebeat/" target="_blank">History of bytebeat</a><br />
<br />
Original blog posts and videos from Viznut:<br />
<a href="http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html" target="_blank">Blog posts #1</a><br />
<a href="http://countercomplex.blogspot.com.au/search/label/algorithmic%20music" target="_blank">Blog posts #2</a><br />
<a href="https://www.youtube.com/watch?v=GtQdIYUtAHg" target="_blank">YouTube video #1</a><br />
<a href="https://www.youtube.com/watch?v=qlrs2Vorw2Y" target="_blank">YouTube video #2</a><br />
<a href="https://www.youtube.com/watch?v=tCRPUv8V22o" target="_blank">YouTube video #3</a><br />
<br />
This website is a live editing bytebeats player. It has a collection of bytebeat music I found on the internet, and also the music I created.<br />
You can choose between bytebeat, signed bytebeat and floatbeat formats. Bytebeat expects output is an unsigned 8bit value (0 to 255). Signed bytebeat assumes output is a signed 8bit value (-127 to 128). Floatbeat assumes output is -1.0 to 1.0.<br />
<br />
This website is the fork of <a href="http://dollchan.net/bytebeat" target="_blank">Bytebeat composer</a> by <a href="http://Github.com/SthephanShinkufag" target="_blank">StephanShi.</a>.<br />
Forked by Chase T aka Chasyxx.
<br /><br />
ShephShi's website is the fork of <a href="http://entropedia.co.uk/generative_music/" target="_blank">8-bit Generative Composer</a> by <a href="http://twitter.com/paul_hayes/" target="_blank">@paul_hayes</a>.<br />
Forked by SthephanShi aka Viraya.
<br /><br />
Custom functions include: <ul>
<li>bitC: <b>(X,Y,Z)</b> => <i>X</i>&<i>Y</i>?<i>Z</i>:0</li>
<li>br: <b>(T,SIZE)</b> => Bit reverses <i>SIZE</i> bits of <i>T</i>, discards the other bits</li>
<li><b><i>sinf, cosf, tanf</i>: (X)</b> => <i>sin, cos, tan</i> but inputting t will output the same freqency as t by itself. AKA the function loops around every 256 "steps" instead of every 2pi steps</li>
<li>regG: <b>(T,regEx)</b> => takes a string of <i>T</i>'s bits, and tests against <i>regEx</i> for a match. Outputs a boolean.</li>
</ul>
<warning>Note: Using any of these functions makes your code exotic, entailing that it will not be added to the dollChan library.<br />
They are just a novelty, and use them at your own risk.</warning>
</article>
</details>
<details class="library-content">
<summary class="library-header" id="favorites-button">
<h1>Favorites — Codes you saved</h1>
</summary>
<article id="info" class="library-container entry-top">
<div class="controls">New favorite: <input type="text" value="Name" id="favorite-name"><button id="favorite-save">Save</button></div>
All favorites are stored as cookies. <warning>Samplerate and mode are not saved, so all favorites load as 8kHz bytebeat.</warning>
<div id="favorites-status"></div>
<ul id="favorites-contents"></ul>
</article>
</details>
<details class="library-content">
<summary class="library-header">
<h1>Classic — C compatible code with one variable (t)</h1>
<svg class="loading-wait hidden"><use xlink:href="#symbol-wait"/></svg>
</summary>
<div id="library-classic" class="library-container"></div>
</details>
<details class="library-content">
<summary class="library-header">
<h1>Compact JS — compact JavaScript code</h1>
<svg class="loading-wait hidden"><use xlink:href="#symbol-wait"/></svg>
</summary>
<div id="library-compact-js" class="library-container"></div>
</details>
<details class="library-content">
<summary class="library-header">
<h1>Big JS — big JavaScript code</h1>
<svg class="loading-wait hidden"><use xlink:href="#symbol-wait"/></svg>
</summary>
<div id="library-big-js" class="library-container"></div>
</details>
<details class="library-content">
<summary class="library-header">
<h1>Floatbeat — assumes output is -1.0 to 1.0<h1>
<svg class="loading-wait hidden"><use xlink:href="#symbol-wait"/></svg>
</summary>
<div id="library-floatbeat" class="library-container"></div>
</details>
<details class="library-content">
<summary class="library-header">
<h1>SthephanShi — code SthephanShi created</h1>
<svg class="loading-wait hidden"><use xlink:href="#symbol-wait"/></svg>
</summary>
<div id="sthephanshi" class="library-container"></div>
</details>
<details class="library-content">
<summary class="library-header">
<h1>Chasyxx — code Chasyxx created<h1>
<svg class="loading-wait hidden"><use xlink:href="#symbol-wait"/></svg>
</summary>
<div id="library-chasyxx" class="library-container"></div>
</details>
<details class="library-content hidden optionalEntry">
<summary class="library-header">
<h1>Pouet — Pouet threads</h1>
</summary>
<article id="info" class="library-container entry-top">
<p>This is the main bytebeat thread. Wurstcaptures links are broken, so copy them and put them in the tools to get your codes.</p>
<iframe src="https://www.pouet.net/topic.php?which=8357" style="width: 100%" height="256"></iframe>
<a href="https://www.pouet.net/topic.php?which=8357">Page link</a>
</article>
</details>
<details class="library-content hidden optionalEntry">
<summary class="library-header">
<h1>Tools — Tools that are better off left out of the options menus</h1>
</summary>
<article id="info" class="library-container entry-top">
<iframe src="https://chasyxx.github.io/ChyxTools/" style="width: 100%" height="256"></iframe>
</article>
</details>
<footer>
<a class="link" href="https://dollchan.net/btb" title="Dollchan discussion threads" target="_blank">>> Dollchan Discussion threads</a><br />
<a class="link" href="https://github.com/Chasyxx/EnBeat_NEW" title="Github repository" target="_blank">>> Github</a>
</footer>
</section>
</main>
<!-- SVG BUTTONS -->
<div id="svg-icons" style="height: 0; width: 0; overflow: hidden;">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<symbol viewBox="0 0 32 32" id="symbol-play">
<path d="m23 14.3-9-5.2c-1.3-.8-3 .2-3 1.7v10.4c0 1.5 1.7 2.5 3 1.7l9-5.2c1.3-.7 1.3-2.7 0-3.4z"/>
</symbol>
<symbol viewBox="0 0 32 32" id="symbol-fast">
<path d="M17.3 11.7v8.6c0 1.7 2 2.6 3.3 1.5l5.3-4.3c1-.8 1-2.3 0-3.1l-5.3-4.3c-1.3-1-3.3-.1-3.3 1.6"/>
</symbol>
<symbol viewBox="0 0 32 32" id="symbol-pause">
<path d="M12.5 23c-1.1 0-2-.9-2-2V11c0-1.1.9-2 2-2s2 .9 2 2v10c0 1.1-.9 2-2 2zm7 0c-1.1 0-2-.9-2-2V11c0-1.1.9-2 2-2s2 .9 2 2v10c0 1.1-.9 2-2 2z"/>
</symbol>
<symbol viewBox="0 0 32 32" id="symbol-stop">
<path d="M20.3 22.3h-8.5c-1.1 0-2-.9-2-2v-8.5c0-1.1.9-2 2-2h8.5c1.1 0 2 .9 2 2v8.5c0 1.1-.9 2-2 2z"/>
</symbol>
<symbol viewBox="0 0 32 32" id="symbol-reset">
<path d="M11.8 22.3c-1.1 0-2-.9-2-2v-8.5c0-1.1.9-2 2-2s2 .9 2 2v8.5c0 1.1-.9 2-2 2zm10.5-10.6v8.6c0 1.7-2 2.6-3.3 1.6l-5.3-4.3c-1-.8-1-2.3 0-3.1l5.3-4.3c1.3-1.1 3.3-.2 3.3 1.5z"/>
</symbol>
<symbol viewBox="0 0 32 32" id="symbol-rec">
<circle cx="16" cy="16" r="6.3"/>
</symbol>
<symbol viewBox="0 0 32 32" id="symbol-scaledown">
<path d="M16.5 24h-1c-1.1 0-2-.9-2-2V10c0-1.1.9-2 2-2h1c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2zM8 16.5v-1c0-1.1.9-2 2-2h12c1.1 0 2 .9 2 2v1c0 1.1-.9 2-2 2H10c-1.1 0-2-.9-2-2z"/>
</symbol>
<symbol viewBox="0 0 32 32" id="symbol-scaleup">
<path d="M8 16.5v-1c0-1.1.9-2 2-2h12c1.1 0 2 .9 2 2v1c0 1.1-.9 2-2 2H10c-1.1 0-2-.9-2-2z"/>
</symbol>
<symbol viewBox="0 0 32 32" id="symbol-link">
<path d="M17 22.5H8c-1.7 0-3-1.3-3-3v-4c0-1.7 1.3-3 3-3h2v3H9c-.6 0-1 .4-1 1v2c0 .6.4 1 1 1h7c.6 0 1-.4 1-1V15h3v4.5c0 1.7-1.3 3-3 3zm7-3h-2v-3h1c.6 0 1-.4 1-1v-2c0-.6-.4-1-1-1h-7c-.6 0-1 .4-1 1V17h-3v-4.5c0-1.7 1.3-3 3-3h9c1.7 0 3 1.3 3 3v4c0 1.7-1.3 3-3 3z"/>
</symbol>
<symbol viewBox="0 0 32 32" id="symbol-expand">
<path d="M10.5 7.5H13c.8 0 1.5.7 1.5 1.5s-.7 1.5-1.5 1.5h-2.5V13c0 .8-.7 1.5-1.5 1.5s-1.5-.7-1.5-1.5v-2.5c0-1.7 1.3-3 3-3zm11 17H19c-.8 0-1.5-.7-1.5-1.5s.7-1.5 1.5-1.5h2.5V19c0-.8.7-1.5 1.5-1.5s1.5.7 1.5 1.5v2.5c0 1.7-1.3 3-3 3zm3-14V13c0 .8-.7 1.5-1.5 1.5s-1.5-.7-1.5-1.5v-2.5H19c-.8 0-1.5-.7-1.5-1.5s.7-1.5 1.5-1.5h2.5c1.7 0 3 1.3 3 3zm-17 11V19c0-.8.7-1.5 1.5-1.5s1.5.7 1.5 1.5v2.5H13c.8 0 1.5.7 1.5 1.5s-.7 1.5-1.5 1.5h-2.5c-1.7 0-3-1.3-3-3z"/>
</symbol>
<symbol viewBox="0 0 16 16" id="symbol-wait">
<circle fill="#929087" cx="8" cy="2" r="2"/>
<circle fill="#C5C2BA" cx="8" cy="14" r="2"/>
<circle fill="#ACAAA0" cx="2" cy="8" r="2"/>
<circle fill="#79766C" cx="14" cy="8" r="2"/>
<circle fill="#D2CFC6" cx="12.25" cy="12.25" r="2"/>
<circle fill="#9F9C93" cx="3.75" cy="3.75" r="2"/>
<circle fill="#B9B6AE" cx="3.75" cy="12.25" r="2"/>
<circle fill="#868379" cx="12.25" cy="3.75" r="2"/>
</symbol>
</svg>
</div>
</body>
</html>