Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
MysteryPancake authored Mar 17, 2024
1 parent 576c261 commit 6b63f3b
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions html/rawaudio.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 6b63f3b

Please sign in to comment.