Skip to content

Commit b57bacf

Browse files
authored
fix: Use parseFloat for sliders, typos (#122)
* fix: Use parseFloat for sliders, typos * fix: parseFloat args
1 parent f366a17 commit b57bacf

File tree

1 file changed

+21
-31
lines changed

1 file changed

+21
-31
lines changed

step-sequencer/index.html

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
<title>Step Sequencer: MDModemnz</title>
66
<meta
77
name="description"
8-
content="Making an instrument with the Web Audio API"
9-
/>
8+
content="Making an instrument with the Web Audio API" />
109
<meta
1110
name="viewport"
12-
content="width=device-width, initial-scale=1, shrink-to-fit=no"
13-
/>
11+
content="width=device-width, initial-scale=1, shrink-to-fit=no" />
1412
<link rel="stylesheet" type="text/css" href="style.css" />
1513
</head>
1614
<body>
@@ -29,8 +27,7 @@ <h1>ModemDN</h1>
2927
min="60"
3028
max="180"
3129
value="120"
32-
step="1"
33-
/>
30+
step="1" />
3431
<span id="bpmval">120</span>
3532
<input type="checkbox" id="playBtn" />
3633
<label for="playBtn">Play</label>
@@ -49,8 +46,7 @@ <h2>Sweep</h2>
4946
min="0"
5047
max="1"
5148
value="0.2"
52-
step="0.1"
53-
/>
49+
step="0.1" />
5450
<label for="release">Rel</label>
5551
<input
5652
name="release"
@@ -59,8 +55,7 @@ <h2>Sweep</h2>
5955
min="0"
6056
max="1"
6157
value="0.5"
62-
step="0.1"
63-
/>
58+
step="0.1" />
6459
</section>
6560

6661
<section class="pads">
@@ -90,8 +85,7 @@ <h2>Pulse</h2>
9085
min="660"
9186
max="1320"
9287
value="880"
93-
step="1"
94-
/>
88+
step="1" />
9589
<label for="lfo">LFO</label>
9690
<input
9791
name="lfo"
@@ -100,8 +94,7 @@ <h2>Pulse</h2>
10094
min="20"
10195
max="40"
10296
value="30"
103-
step="1"
104-
/>
97+
step="1" />
10598
</section>
10699
<!--
107100
@@ -110,13 +103,13 @@ <h2>Pulse</h2>
110103
<input type="checkbox" id="v2n1" />
111104
<label for="v2n1">Voice 2, Note 1</label>
112105

113-
<input type="checkbox" id="v1n2" />
106+
<input type="checkbox" id="v2n2" />
114107
<label for="v2n2">Voice 2, Note 2</label>
115108

116-
<input type="checkbox" id="v1n3" />
109+
<input type="checkbox" id="v2n3" />
117110
<label for="v2n3">Voice 2, Note 3</label>
118111

119-
<input type="checkbox" id="v1n4" />
112+
<input type="checkbox" id="v2n4" />
120113
<label for="v2n4">Voice 2, Note 4</label>
121114
</section>
122115
</section>
@@ -133,8 +126,7 @@ <h2>Noise</h2>
133126
min="0.25"
134127
max="1"
135128
value="1"
136-
step="0.25"
137-
/>
129+
step="0.25" />
138130
<label for="band">Band</label>
139131
<input
140132
name="band"
@@ -143,8 +135,7 @@ <h2>Noise</h2>
143135
min="400"
144136
max="1200"
145137
value="1000"
146-
step="5"
147-
/>
138+
step="5" />
148139
</section>
149140

150141
<section class="pads">
@@ -174,8 +165,7 @@ <h2>DTMF</h2>
174165
min="0.1"
175166
max="2"
176167
value="1"
177-
step="0.1"
178-
/>
168+
step="0.1" />
179169
</section>
180170
<!--
181171
@@ -216,7 +206,7 @@ <h2>DTMF</h2>
216206
attackControl.addEventListener(
217207
"input",
218208
(ev) => {
219-
attackTime = parseInt(ev.target.value, 10);
209+
attackTime = parseFloat(ev.target.value);
220210
},
221211
false
222212
);
@@ -226,7 +216,7 @@ <h2>DTMF</h2>
226216
releaseControl.addEventListener(
227217
"input",
228218
(ev) => {
229-
releaseTime = parseInt(ev.target.value, 10);
219+
releaseTime = parseFloat(ev.target.value);
230220
},
231221
false
232222
);
@@ -260,7 +250,7 @@ <h2>DTMF</h2>
260250
hzControl.addEventListener(
261251
"input",
262252
(ev) => {
263-
pulseHz = parseInt(ev.target.value, 10);
253+
pulseHz = parseFloat(ev.target.value);
264254
},
265255
false
266256
);
@@ -270,7 +260,7 @@ <h2>DTMF</h2>
270260
lfoControl.addEventListener(
271261
"input",
272262
(ev) => {
273-
lfoHz = parseInt(ev.target.value, 10);
263+
lfoHz = parseFloat(ev.target.value);
274264
},
275265
false
276266
);
@@ -314,7 +304,7 @@ <h2>DTMF</h2>
314304
bandControl.addEventListener(
315305
"input",
316306
(ev) => {
317-
bandHz = parseInt(ev.target.value, 10);
307+
bandHz = parseFloat(ev.target.value);
318308
},
319309
false
320310
);
@@ -363,7 +353,7 @@ <h2>DTMF</h2>
363353
rateControl.addEventListener(
364354
"input",
365355
(ev) => {
366-
playbackRate = parseInt(ev.target.value, 10);
356+
playbackRate = parseFloat(ev.target.value);
367357
},
368358
false
369359
);
@@ -395,7 +385,7 @@ <h2>DTMF</h2>
395385
bpmControl.addEventListener(
396386
"input",
397387
(ev) => {
398-
tempo = parseInt(ev.target.value, 10);
388+
tempo = parseFloat(ev.target.value);
399389
bpmValEl.innerText = tempo;
400390
},
401391
false
@@ -449,7 +439,7 @@ <h2>DTMF</h2>
449439
}
450440

451441
// Draw function to update the UI, so we can see when the beat progress.
452-
// This is a loop: it reschudele itself to redraw at the end.
442+
// This is a loop: it reschedules itself to redraw at the end.
453443
let lastNoteDrawn = 3;
454444
function draw() {
455445
let drawNote = lastNoteDrawn;

0 commit comments

Comments
 (0)