and the "audio converter" for node.js i just installed... literally doesn't convert files between formats? i just looked at the source code and found it uselessly converts the file to base64 and then back to bits again??
what a night
zsh: file public/cry/1.mp3
public/cry/1.mp3: Ogg data, Vorbis audio, mono, 32728 Hz, ~86000 bps, created by: Xiph.Org libVorbis I (1.3.4)
zsh: file public/cry/1.ogg
public/cry/1.ogg: Ogg data, Vorbis audio, mono, 32728 Hz, ~86000 bps, created by: Xiph.Org libVorbis I (1.3.4)
/* eslint-disable no-console */
import fs from "fs";
import path from "path";
import { execFileSync } from "child_process";
const CRY_SRC = "public/cry";
const CRY_DEST = "public/cry";
export async function convertAudio() {
for (const name of fs.readdirSync(CRY_SRC)) {
if (!name.endsWith(".ogg")) {
continue;
}
const baseName = path.basename(name, ".ogg");
const fullName = path.join(CRY_SRC, name);
const outputName = path.join(CRY_DEST, `${baseName}.mp3`);
if (!fs.existsSync(outputName)) {
console.log("Converting", fullName, "...");
execFileSync("ffmpeg", ["-v", "quiet", "-y", "-i", fullName, outputName]);
}
}
}

