the ultimate vocal synthesizer - sing, speak, beatbox, and more
Rust
Windows: file URLs became filesystem paths with .pathname ("/E:/..."), so bun tests failed with ENOENT; use fileURLToPath
Sayoe8482419ec14
diff --git a/tests/harness.ts b/tests/harness.tsindex 29d1d6b..f317bd9 100644--- a/tests/harness.ts+++ b/tests/harness.ts@@ -2,12 +2,13 @@* Test harness for the wasm engine in bun: loads the build (`bun run wasm`) for the main-thread* facade, and runs separate engine instances the way the AudioWorklet does.*/+import { fileURLToPath } from "node:url";import { readFileSync } from "node:fs";import { initChimera } from "../src/wasm/chimera.ts";import { writeGestures, fromUtf8 } from "../src/wasm/wire.ts";import type { Gesture } from "../src/wasm/types.ts";-export const WASM_PATH = new URL("../src/wasm/chimera.wasm", import.meta.url).pathname;+export const WASM_PATH = fileURLToPath(new URL("../src/wasm/chimera.wasm", import.meta.url));const bytes = readFileSync(WASM_PATH);export const wasmModule = new WebAssembly.Module(bytes);diff --git a/tests/musicxml-to-notes.test.ts b/tests/musicxml-to-notes.test.tsindex 8ac5af9..527eb8c 100644--- a/tests/musicxml-to-notes.test.ts+++ b/tests/musicxml-to-notes.test.ts@@ -3,12 +3,13 @@* sung in play order, words come back together for the dictionary, and words the dictionary* can't fit to their notes stop the tool rather than shift every later syllable.*/+import { fileURLToPath } from "node:url";import { describe, expect, test } from "bun:test";import { mkdtempSync, writeFileSync } from "node:fs";import { tmpdir } from "node:os";import { join } from "node:path";-const TOOL = new URL("../tools/musicxml-to-notes.ts", import.meta.url).pathname;+const TOOL = fileURLToPath(new URL("../tools/musicxml-to-notes.ts", import.meta.url));const dir = mkdtempSync(join(tmpdir(), "musicxml-"));/** a one-part score in 4/4, one beat per division, at 100 bpm */diff --git a/tests/wasm-engine.test.ts b/tests/wasm-engine.test.tsindex 21b9022..b3b46bf 100644--- a/tests/wasm-engine.test.ts+++ b/tests/wasm-engine.test.ts@@ -3,12 +3,13 @@* for bit) on the voice scenarios, driven through the gesture-record codec the worklet uses.* Needs `bun run wasm` (the wasm build) and cargo (it renders the native reference).*/+import { fileURLToPath } from "node:url";import { describe, expect, test } from "bun:test";import { readFileSync, existsSync } from "node:fs";import { writeGestures, CONTROL_KEYS, GESTURE_RECORD } from "../src/wasm/wire.ts";import type { Gesture } from "../src/wasm/types.ts";-const ROOT = new URL("..", import.meta.url).pathname;+const ROOT = fileURLToPath(new URL("..", import.meta.url));const WASM = `${ROOT}target/wasm32-unknown-unknown/release/chimera_wasm.wasm`;const SOURCE_KEYS = ["f0", "glide", "pressure", "breathiness", "tension", "fry", "roughness", "vibratoDepth", "vibratoRate", "drift", "voiced", "brightness"];diff --git a/tools/bench-wasm.ts b/tools/bench-wasm.tsindex efbae47..45c4525 100644--- a/tools/bench-wasm.ts+++ b/tools/bench-wasm.ts@@ -2,10 +2,11 @@* Real-time factor of the human voice in the wasm build (as the AudioWorklet runs it), on a* fixed utterance. Usage: bun tools/bench-wasm.ts (after `bun run wasm`).*/+import { fileURLToPath } from "node:url";import { readFileSync } from "node:fs";import { writeGestures } from "../src/wasm/wire.ts";-const ROOT = new URL("..", import.meta.url).pathname;+const ROOT = fileURLToPath(new URL("..", import.meta.url));const scenario = JSON.parse(readFileSync(`${ROOT}crates/chimera/tests/golden/voice.json`, "utf8")).find((s: { name: string }) => s.name === "speech-male");const gestures = scenario.ops[0].gestures;const FS = 48000, SECS = 4, BLOCKS = (FS * SECS) / 128;diff --git a/tools/gen-ipa-nfc.ts b/tools/gen-ipa-nfc.tsindex aea7bf8..e1ad001 100644--- a/tools/gen-ipa-nfc.ts+++ b/tools/gen-ipa-nfc.ts@@ -13,6 +13,7 @@* The data comes from the JS engine's own ICU, so it matches what the TypeScript engine did.* Usage: bun tools/gen-ipa-nfc.ts*/+import { fileURLToPath } from "node:url";import { readFileSync, writeFileSync } from "node:fs";import { initChimera, call } from "../src/wasm/chimera.ts";@@ -80,7 +81,7 @@ for (const s of significant) if (s.normalize("NFD") !== s && s !== "ç") throw nfor (const [f, m] of comp) if (f === 0x63 && rankOf.get(m)! < rankOf.get(0x327)!) throw new Error("c composes before the cedilla");for (const [, d] of decomp) for (const c of d) if (significant.has(ch(c)) && !rankOf.has(c)) console.warn(`decomposition yields symbol ${ch(c)}`);-const path = new URL("../crates/chimera/src/phonetics/ipaNfc.generated.json", import.meta.url).pathname;+const path = fileURLToPath(new URL("../crates/chimera/src/phonetics/ipaNfc.generated.json", import.meta.url));const text = JSON.stringify({ ccc, decomp, comp });writeFileSync(path, text + "\n");console.log(`${marks.length} marks in ${classes.length} classes (${ccc.length} ranges), ${decomp.length} decompositions, ${comp.length} compositions, ${(text.length / 1024).toFixed(1)} KB`);