-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
174 lines (172 loc) · 4.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>#MidiFlip</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="lib/midi/MIDIEvents.js"></script>
<script src="lib/midi/MIDIFile.js"></script>
<script src="src/midiflip.js"></script>
<script src="lib/math.min.js"></script>
<script src="lib/async.js"></script>
<script src="lib/zip-js/zip.js"></script>
<script>zip.workerScriptsPath = "lib/zip-js/";</script>
</head>
<body>
<style>
html,
body {
height: 100%;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
}
body {
font-family: sans-serif;
padding: 0 1rem;
box-sizing: border-box;
}
main {
flex: 1 0 auto;
}
footer {
text-align: center;
padding-bottom: 1rem;
}
h1, h2, h3, h4, h5, h6, p, #clear-results {
margin: 1.5rem 0;
display: block;
}
h1, h2, h3, h4, h5, h6, p {
margin-bottom: 0;
}
h1, h2, h3, h4, h5, h6 {
margin-bottom: 0;
}
h1 {
font-size: 3.5em;
}
h2 {
font-size: 2em;
/*font-size: 1.7em;*/
/*margin-top: 0;*/
}
h3 {
font-size: 1.7em;
}
h4 {
font-size: 1.2em;
}
ul {
margin: 0;
padding: 0;
}
li {
background: white;
color: rgba(0, 0, 0, 0.7);
list-style: none;
margin: 1em 0;
padding: 0.5em;
border-radius: 2px;
}
.error {
color: #ff5722;
}
progress {
float: right;
}
</style>
<header>
<h1>MidiFlip</h1>
<h2>Transform MIDI files mathematically</h2>
</header>
<main>
<p>
Drag and drop some MIDI files or
<a role="button" href="#" id="select-files">select files</a>
to transform.
<!-- FIXME: the file selection button and drag and drop text are now too far away from the results.
I could move it down to the bottom,
maybe put it under the section with the results
but with a different heading than "Results"? -->
</p>
<p>
You can then download the files individually or as a zip.
If you change the settings, the results will be updated automatically.
</p>
<h3>Settings</h3>
<p>
<label>
Transform (mathematical expression): <b>n′</b> =
<input type="text" value="127 - n" placeholder="127 - n" id="transform-expression"/>
</label>
<label>
Preset:
<select id="transform-presets">
<option value="n">No Transform</option>
<option value="127 - n" selected>Basic Flip</option>
<!--TODO:-->
<!--<option value="center - n" selected>Standard Flip</option>-->
<!--<option value="127 - n">Absolute Flip</option>-->
<option value="n + 12">Transpose: octave up</option>
<option value="n - 12">Transpose: octave down</option>
<option value="n + 3">Transpose: 3 semitones up</option>
<option value="n - 8">Transpose: 8 semitones down</option>
<option value="60">Make All Notes Middle C</option> <!-- hear the rhythm in isolation -->
<option value="(n + channel * 12) mod 127">Simple Octave Channel-Split</option>
<option value="(n + (channel - 4) * 12) mod (127 - 12 * 2)">Nicer Octave Channel-Split</option>
<option value="floor(n / 12 * 8) * 12 / 8">Pitch Quantization: 8 notes/octave</option>
<option value="floor(n / 12 * 5) * 12 / 5">Pitch Quantization: 5 notes/octave</option>
<option value="n / 12 * 8 + 20">Squishy Pitch Quantization</option>
<!-- Can use sin/cos/whatever for pseudorandom mapping -->
<!-- or random() for (still technically pseudo-)randomness -->
<!-- random octave jumps: n + floor(random(2)) * 12 -->
<!-- something: ((n mod 12) * (n |^ 12) - n + 127) mod 127 -->
<option value="" id="custom-transform">Custom</option>
</select>
</label>
</p>
<p>
See <a href="http://mathjs.org/docs/expressions/syntax.html">mathjs syntax</a>.
Available variables:
<b>n</b> = the note number from 0 to 127;
<b>channel</b> = the channel number from 0 to 16
</p>
<p>
<label>
<input type="checkbox" id="mess-with-percussion"/>
Purposefully mess with percussion
</label>
<!--
TODO: have two separately configurable transforms for percussion and non-percussion notes like:
[x] Transform pitches [Preset v] n′ = [127 - n ]
[x] Transform percussion [Preset v] n′ = [127 - n ]
Or even just:
Pitch transform: [Basic Flip v] n′ = [127 - n ]
Percussion transform: [No Transform v] n′ = [n ]
"Percussion transform" doesn't roll off the tongue
It could still be:
Transform pitches: [Basic Flip v] n′ = [127 - n ]
Transform percussion: [No Transform v] n′ = [n ]
But then again checkboxes are probably good
-->
</p>
<output id="results-container" hidden>
<h3>Results</h3>
<ul id="output-list"></ul>
<div id="results-zipped-container" hidden>
<h4>Zipped Results</h4>
<ul id="output-zipped"></ul>
<button id="clear-results">Clear Results</button>
</div>
</output>
</main>
<footer>
<p>
Made by <a href="https://isaiahodhner.io/">Isaiah Odhner</a>.
Open source <a href="https://github.com/1j01/midiflip">on GitHub</a>.
</p>
</footer>
<script src="src/app.js"></script>
</body>