forked from dyemagenta/bytebeat-1
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
226 lines (224 loc) · 12.2 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
<!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">
<title>Bytebeat 1.1</title>
<link rel="canonical" href="https://cokufaqikk.github.io/bytebeat/"/>
<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>
</head>
<body>
<main id="content">
<section id="container-fixed">
<div id="editor-container">
<textarea id="editor-default" spellcheck="false">t*((t&4096?6:16)+(1&t>>14))>>(3&t>>8)|t>>(t&4096?3:4)</textarea>
</div>
<div class="controls">
<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>
<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 value="Points" selected>points</option>
<option value="Waveform">waveform</option>
</select>
<select id="control-mode" class="control-select controls-grow" title="Sound mode">
<option value="Bytebeat" selected>bytebeat</option>
<option value="Signed Bytebeat">signed bytebeat</option>
<option value="Floatbeat">floatbeat</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">8000hz</option>
<option value="11025">11025hz</option>
<option value="16000">16000hz</option>
<option value="22050">22050hz</option>
<option value="32000">32000hz</option>
<option value="44100">44100hz</option>
<option value="48000">48000hz</option>
</select>
</div>
<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>
</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://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.
</article>
</details>
<details class="library-content">
<summary class="library-header">
<h1>Publiched — random codes from various sources</h1>
<svg class="loading-wait hidden"><use xlink:href="#symbol-wait"/></svg>
</summary>
<div id="library-publiched" class="library-container"></div>
</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="library-sthephanshi" class="library-container"></div>
</details>
<footer>
<a class="link" href="/btb/" title="Bytebeat discussion threads" target="_blank">>> Discussion threads</a><br>
<a class="link" href="https://github.com/SthephanShinkufag/bytebeat-composer" title="Github repo" 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>