Skip to content

the ultimate vocal synthesizer - sing, speak, beatbox, and more

Rust

The web app opens on Sing (it opened on Play); the dictionary loads with the Sing panel

Jameson Hodged2d134948de1
diff --git a/src/ui/components/SingPanel.tsx b/src/ui/components/SingPanel.tsx
index ff6a92d..d0f40c4 100644
--- a/src/ui/components/SingPanel.tsx
+++ b/src/ui/components/SingPanel.tsx
@@ -1,5 +1,6 @@
+import { useEffect } from "react";
import { useStore } from "../store.ts";
-import { useSing, playDemo, stopSinging, soundingSyllable, sungNow, DEMO_SONGS } from "../singing.ts";
+import { useSing, playDemo, stopSinging, soundingSyllable, sungNow, DEMO_SONGS, ensureDictionary } from "../singing.ts";
import { mouthWords } from "../mouthWords.ts";
import { V } from "../colors.ts";
import { Keys } from "./Keys.tsx";
@@ -138,6 +139,9 @@ function DemoSongs() {
/** Sing mode's right column: the piano roll, the lyrics, the spectrum with the ring, the song voice, the keys. */
export function SingRight() {
+ // the pronouncing dictionary for the lyrics: here rather than on the mode switch, since the app
+ // opens on Sing without one
+ useEffect(ensureDictionary, []);
const ring = useStore((s) => s.artic.epilarynx >= RING - 0.05);
const next = useSing((s) => (s.demo ? null : (s.syllables[s.cursor]?.text ?? null)));
return (
diff --git a/src/ui/store.ts b/src/ui/store.ts
index 29ac889..348fb97 100644
--- a/src/ui/store.ts
+++ b/src/ui/store.ts
@@ -6,7 +6,7 @@ import { defaultF0, PRESETS, sameBody, type BodyMix } from "./body.ts";
import { creatureById } from "../wasm/engine.ts";
import type { ParamDef } from "../wasm/types.ts";
import { BEAT_PRESETS, BASS_NOTE, beatReady, parseBeat, type BeatStep } from "../wasm/engine.ts";
-import { singNoteOn, singNoteOff, stopSinging, ensureDictionary } from "./singing.ts";
+import { singNoteOn, singNoteOff, stopSinging } from "./singing.ts";
import { stopSpeaking } from "./speech.ts";
import { connectMidi, disconnectMidi, type MidiStatus } from "./midi.ts";
@@ -140,7 +140,8 @@ export const useStore = create<State>((set, get) => ({
hold: false,
heldNotes: [],
view: { pressure: true, particles: true, grid: false, calipers: true, threeD: false },
- mode: "play",
+ // the app opens on Sing: hearing a song is the quickest way in (the plugin opens there too)
+ mode: "sing",
setMode: (m) => {
const prev = get().mode;
if (prev === m) return;
@@ -172,7 +173,6 @@ export const useStore = create<State>((set, get) => ({
if (prev === "sing") stopSinging();
// speech and song breathe by themselves: a held breath would drone under them
if (m === "speak" || m === "sing") set({ hold: false });
- if (m === "sing") ensureDictionary();
if (m === "beatbox") {
// a beatboxer waits with the jaw nearly closed; the sounds bring their own breath
set({ hold: false });
diff --git a/tools/e2e.ts b/tools/e2e.ts
index af6845e..e93fc09 100644
--- a/tools/e2e.ts
+++ b/tools/e2e.ts
@@ -27,6 +27,8 @@ async function run(viewport: { width: number; height: number }, tag: string) {
await page.goto(url, { waitUntil: "networkidle" });
await page.waitForTimeout(400);
await page.screenshot({ path: `${outDir}/${tag}-0-idle.png` });
+ // the app opens on Sing; this run starts in Play
+ await page.getByRole("radio", { name: "Play" }).click();
const startBtn = page.getByRole("button", { name: /breathe in and start/i });
await startBtn.click();
await page.waitForTimeout(1800);