-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
235 lines (224 loc) · 9 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
<!doctype html>
<!--
Made with love by MindfulMinun
https://benjic.xyz
-->
<html lang="en-US" dir="ltr">
<head>
<meta charset="utf-8">
<title>D♭</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#1e1e1e">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css">
<style media="screen">
*, *::before, *::after { box-sizing: border-box; }
:root {
--input-color: rgb(255 255 255 / .52);
--input-border: #424242;
--accent: #448aff;
}
html, body {
font-family: "Roboto", Helvetica, Arial, sans-serif;
line-height: 1.15;
height: 100%;
margin: 0;
color: white;
background-color: black;
}
body { display: flex; }
a[href] { color: var(--accent); }
input, audio {
display: block;
margin: 1em 0;
}
audio {
width: 100%;
}
button {
/* display: inline-block;
background: 0; border: 0; font: inherit; color: inherit;
border: 1px solid #727272;
padding: .25em .5em;
cursor: pointer; */
background: 0; border: 0; font: inherit;
color: var(--input-color);
font-size: 87.5%;
border: 2px solid var(--input-border);
outline: 0;
padding: .5em .75em;
}
select {
/* background: 0; border: 0; font: inherit; color: inherit; */
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
background: 0;
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNHB4IiBoZWlnaHQ9IjI0cHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0iIzU0NTQ1NCI+PHBhdGggZD0iTTcgMTBsNSA1IDUtNXoiPjwvcGF0aD48L3N2Zz4=);
background-position: right 50%;
background-repeat: no-repeat;
outline: 0;
border: 2px solid var(--input-border);
border-radius: 0;
color: var(--input-color);
font: inherit;
font-size: 87.5%;
/* padding: .5em 1.5em .5em 1em; */
padding: .5em 1.5em .5em .5em;
min-width: 120px;
}
option { color: initial; }
option[disabled] { color: rgb(0 0 0 / .3); }
button:focus,
select:focus {
border-color: var(--accent);
}
button, select, details {
backdrop-filter: blur(2px);
}
summary {
cursor: pointer;
margin: -1em;
padding: 1em;
/* color: var(--input-color); */
}
details {
border: 2px solid var(--input-border);
padding: 1em;
}
details[open] > summary {
margin: -1em -1em 1em;
border-bottom: 2px solid var(--input-border);
}
details > summary:focus {
outline: 2px solid var(--accent);
outline-offset: -2px;
}
canvas {
position: fixed;
top: 0; left: 0; bottom: 0; right: 0;
width: 100%;
height: 100%;
background-color: #000;
}
.container {
width: 840px;
max-width: 100%;
margin: 0 auto;
padding: 1em;
z-index: 1;
}
.warn {
border: 2px solid red;
padding: 0 1em;
}
.spacer {
/* height: 90vh; */
height: 1000px;
height: 90vh;
height: calc(100vh - 6rem);
}
.credits {
text-align: center;
font-style: italic;
margin: 3rem auto;
opacity: .5;
}
</style>
</head>
<body>
<canvas></canvas>
<div class="container">
<p>
Drag and drop an audio file anywhere or <button id="choose">choose one from your filesystem.</button>
</p>
<p>
<label>
Filter:
<select id="processorSelect">
<option value="noop" selected>noop</option>
<option value="derivative">derivative</option>
<option value="integral">integral</option>
<option value="subtract-overlap">subtract-overlap</option>
<option value="isolate-overlap" disabled>isolate-overlap</option>
<option value="bit-crusher-sr8">bit-crusher-sr8 (Sample-rate reduction)</option>
<option value="bit-crusher-res">bit-crusher-res (bit-depth reduction)</option>
<option value="bit-crusher-both">bit-crusher-both</option>
<option value="mono">mono</option>
<option value="zeroes">zeroes</option>
</select>
</label>
<label>
Visualizer:
<select id="visualizerSelect">
<option value="0" selected>Oscilloscope</option>
<option value="1">Linear spectrogram</option>
</select>
</label>
</p>
<audio controls></audio>
<details>
<summary>What does each filter do?</summary>
<ul>
<li>
<code>noop</code>
<p>Leaves the audio unchanged.</p>
</li>
<li>
<code>derivative</code>
<p>
Approximates the first derivative of the audio as a function respect to time.
Sounds like a <strong>high-pass filter</strong>.
</p>
</li>
<li>
<code>integral</code>
<p>
Approximates the first integral of the audio as a function respect to time. Plus C of zero. Sounds like a <strong>low-pass filter</strong>.
</p>
</li>
<li>
<code>subtract-overlap</code>
<p>Inverts the amplitude of every even-numbered channel and merges all channels to mono. This effectively cancels the sounds the left and right channels share in common. Quick-and-dirty way of removing vocals.</p>
</li>
<li>
<code>isolate-overlap</code>
<p>The opposite of subtract-overlap. You think it'd be simple but I can't get it to work :/</p>
</li>
<!-- bit-crusher-sr8
bit-crusher-res -->
<li>
<code>bit-crusher-sr8</code>
<p>Bitcrusher. Works by taking the average of 8 samples of the input and setting that average as the output for those 8 samples, effectively <strong>reducing the sampling rate</strong>.</p>
</li>
<li>
<code>bit-crusher-res</code>
<p>Bitcrusher. Works by <strong>reducing the resolution of each sample</strong> from a 32-bit float to a 8-bit float.</p>
</li>
<li>
<code>bit-crusher-both</code>
<p>Bitcrusher. Combines the output of bit-crusher-sr8 and bit-crusher-res.</p>
</li>
<li>
<code>mono</code>
<p>
Converts the audio to mono by taking the arithmetic average of the samples of each channel.
</p>
</li>
<li>
<code>zeroes</code>
<p>Outputs no sound.</p>
</li>
</ul>
</details>
<p class="credits">
Made with :3c by <a href="https://benjic.xyz">MindfulMinun</a>
•
<a href="https://github.com/MindfulMinun/d-flat">Source code</a>
</p>
<div class="spacer"></div>
</div>
<input id="file" type="file" hidden>
<script src="./dist/main.js"></script>
</body>
</html>