From 6b63f3bf903374df4a98c83e736a496525ea1c25 Mon Sep 17 00:00:00 2001 From: MysteryPancake Date: Sun, 17 Mar 2024 14:37:44 +1100 Subject: [PATCH] Add files via upload --- html/rawaudio.html | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/html/rawaudio.html b/html/rawaudio.html index 90e68b3..7c04375 100644 --- a/html/rawaudio.html +++ b/html/rawaudio.html @@ -158,17 +158,20 @@ function readSamples(elem) { let samples = []; - elem.value.split(sepElem.value).forEach((str) => { - str = str.trim(); - if (str) { - const num = parseFloat(str); - if (isNaN(num)) { - window.alert(`Invalid number: ${str}`); - return; - } - samples.push(num); + const strings = elem.value.split(sepElem.value); + + for (let i = 0; i < strings.length; ++i) { + const str = strings[i].trim(); + if (!str) continue; + + const num = parseFloat(str); + if (isNaN(num)) { + window.alert(`Invalid number: ${str}`); + return; } - }); + + samples.push(num); + }; return new Float32Array(samples); }