the ultimate vocal synthesizer - sing, speak, beatbox, and more
Rust
Tabs: one main button per tab, in one place, that also starts the audio (no start overlay)
Jameson Hodge704ed2c336ed
diff --git a/README.md b/README.mdindex 4d5bd65..ace7da7 100644--- a/README.md+++ b/README.md@@ -26,7 +26,7 @@ for tests and the `chimera` CLI.computer keyboard and Web MIDI.- **Speak**: English text (CMUdict with a letter-to-sound fallback) or IPA, turned intogestures and prosody, with the gestural score and a consonant chart on screen.-- **Sing**: piano roll with lyrics per note; consonants land before the beat. Lyrics can be+- **Sing**: a pitch roll with lyrics per note; consonants land before the beat. Lyrics can beEnglish or Korean (Hangul: one block per note, with Korean sound rules); each language is afront end ([docs/language-front-ends.md](docs/language-front-ends.md)).- **Beatbox**: pads and a step sequencer, every drum an articulatory gesture.diff --git a/docs/ui-redesign.md b/docs/ui-redesign.mdindex 4394c10..8cabff3 100644--- a/docs/ui-redesign.md+++ b/docs/ui-redesign.md@@ -41,21 +41,22 @@ A hook, `usePhosphor(draw)`, replaces `useCanvasLoop` for the vector screens: DP- **Pages of four.** An encoder screen shows four and pages through the rest:- Play: VOICE (pitch, breath, pressed, vibrato), TONE (breathy, rough, fry, glide), MOUTH (lip round, lip open, protrude, jaw), THROAT (tongue root, tip curl, velum, larynx), LARYNX (twang, false folds).- Sing: vibrato depth, rate, breathy, ring. Beatbox: tempo, swing, mic, bass note. Bestiary: the creature's params, four per page.-- **Chips** replace toggles and segmented buttons: a framed caps label, lit when on. Mode and body tabs are chips in the top bar.+- **Chips** replace toggles and segmented buttons: a framed caps label, lit when on. Mode tabs are chips in the top bar; the body's (and its triangle) are in the face screen's header.- **View options** (pressure, airflow, measurements, grid) become chips in the face screen's corner.-- **Start prompt** becomes a framed overlay on the left screen with one lit chip ("BREATHE IN AND START").+- **One main button per mode** (`ActionBar`), in the same place: the top of the right column, amber (it makes sound), with the few settings that belong beside it. It also starts the audio, so there is no start prompt; it reads Stop while its sound plays, and Space presses it unless the focus is in a field or on another control.+- **The whole head** is always drawn: the crown and the back of the skull are never cropped (`HEAD` in `render/anatomy.ts`).## Screens per mode| Mode | Left | Right column ||---|---|---|-| Play | face (`AnatomyView`) | tube, vocal folds, spectrum, vowels, voice encoders, keys |-| Speak | face | say (text field, chips, transcription), gestural score, consonant chart, tube, vocal folds |-| Sing | face | piano roll, lyrics chips, spectrum with the ring zone, song encoders, keys |-| Beatbox | face with the hit's big symbol | step sequencer, waterfall spectrogram, pads, transport encoders + presets, compact keys |-| Bestiary | creature (`CreatureView`) | creature gallery, waterfall spectrogram, calls, creature encoders, unrolled airway, compact keys |+| Play | face (`AnatomyView`) | Breathe + Whisper; tube, vocal folds, spectrum, vowels, voice encoders, keys |+| Speak | face | Speak + rate + IPA; say (text field, transcription, examples), gestural score, consonant chart, tube, vocal folds |+| Sing | face | Sing + song menu; pitch roll, lyrics chips, spectrum with the ring zone, song encoders, keys |+| Beatbox | face with the hit's big symbol | Play beat + pattern menu + Mic FX; step sequencer, waterfall spectrogram, pads, tempo encoders + the beat as text, bass keys |+| Bestiary | creature (`CreatureView`, its description under its name) | the calls + Breathe; creature gallery, waterfall spectrogram and unrolled airway, creature encoders, compact keys |-`Keys` also owns the computer-keyboard listeners and the MIDI connect button, so every mode that has keys today keeps at least a compact keys strip. (Speak never had them: it plays text, not notes.)+`Keys` also owns the computer-keyboard listeners, and `MidiButton` is a chip in each keys screen's header, so every mode that has keys today keeps at least a compact keys strip. (Speak never had them: it plays text, not notes.)The mockup generator (`docs/mockups/gen/`) is the reference implementation for each drawing: the same geometry, colours and layout rules, written against the live data the app already has (`HumanFrame`, telemetry, transfer functions, plans, creature visuals).diff --git a/src/ui/App.tsx b/src/ui/App.tsxindex 3263409..0021531 100644--- a/src/ui/App.tsx+++ b/src/ui/App.tsx@@ -6,17 +6,16 @@ import { TubeView } from "./components/TubeView.tsx";import { Stroboscope } from "./components/Stroboscope.tsx";import { SpectrumView } from "./components/SpectrumView.tsx";import { VowelMap } from "./components/VowelMap.tsx";-import { VoiceControls, VoiceToggles } from "./components/VoiceControls.tsx";+import { VoiceControls } from "./components/VoiceControls.tsx";import { Keys, MidiButton } from "./components/Keys.tsx";+import { ActionBar, PrimaryButton } from "./components/ActionBar.tsx";import { Segmented, Toggle } from "./components/Controls.tsx";-import { Screen } from "./components/Screen.tsx";+import { Chip, Screen } from "./components/Screen.tsx";import { SpeakRight, speechInfo, speechSlots, speechWords } from "./components/SpeakPanel.tsx";import { BestiaryRight } from "./components/BestiaryPanel.tsx";import { CreatureView } from "./components/CreatureView.tsx";-import { creatureById } from "../wasm/engine.ts";import { BeatboxRight, BeatOverlay, beatInfo, beatSlots } from "./components/BeatboxPanel.tsx";import { SingRight, singInfo, singWords } from "./components/SingPanel.tsx";-import { playDemo, DEMO_SONGS } from "./singing.ts";import type { Mode } from "./store.ts";import type { BodyName } from "../worklet/protocol.ts";import { BodyPad } from "./components/BodyPad.tsx";@@ -35,8 +34,6 @@ function showId(): string | null {function TopBar() {const started = useStore((s) => s.started);- const starting = useStore((s) => s.starting);- const start = useStore((s) => s.start);const volume = useStore((s) => s.volume);const setVolume = useStore((s) => s.setVolume);const mode = useStore((s) => s.mode);@@ -69,14 +66,10 @@ function TopBar() {<span>Volume</span><input type="range" min={0} max={1} step={0.01} value={volume} onChange={(e) => setVolume(Number(e.target.value))} style={{ "--pos": `${volume * 100}%` } as React.CSSProperties} /></label>- {started ? (+ {started && (<span className="load" title="Share of the audio thread's time budget used by the simulation">Engine load {Math.round(load * 100)} %</span>- ) : (- <button className="primary" onClick={() => void start()} disabled={starting}>- {starting ? "Starting…" : "Start audio"}- </button>)}<a className="repo-link" href="https://github.com/jamesondh/chimera-vocal-synth" target="_blank" rel="noreferrer" aria-label="Source code on GitHub" title="Source code on GitHub"><svg viewBox="0 0 16 16" width="18" height="18" aria-hidden="true">@@ -106,46 +99,6 @@ function ViewToggles() {);}-function StartPrompt() {- const started = useStore((s) => s.started);- const starting = useStore((s) => s.starting);- const err = useStore((s) => s.startError);- const start = useStore((s) => s.start);- const setHold = useStore((s) => s.setHold);- const mode = useStore((s) => s.mode);- const playCall = useStore((s) => s.playCall);- const creature = useStore((s) => s.creature);- const setBeatPlaying = useStore((s) => s.setBeatPlaying);- if (started) return null;- const copy = {- bestiary: ["Each animal's sound comes from a simulation of its own sound source and airway.", "Start and hear a call", "Then play its calls, or hold the keys to sustain it at a pitch."],- beatbox: ["Every drum here is a mouth sound: lips, tongue and larynx pushing, sealing and sucking air.", "Start the beat", "Then edit the pattern, tap the pads, or hum a bass note on the keys."],- speak: ["Every sound here is produced by simulating air moving through a throat, mouth and nose.", "Start the voice", "Then type something and press Speak, or tap a sound in the chart."],- sing: ["Every sound here is produced by simulating air moving through a throat, mouth and nose.", "Start and hear a song", "Then play the keys: each note sings the next syllable of the lyrics."],- }[mode as "bestiary" | "beatbox" | "speak" | "sing"] ?? ["Every sound here is produced by simulating air moving through a throat, mouth and nose.", "Breathe in and start", "Then drag the tongue, lips or jaw, or play the keys."];- return (- <div className="start-prompt" data-layout="overlay">- <p>{copy[0]}</p>- <button- className="primary large"- disabled={starting}- onClick={async () => {- // the demo waits for audio itself, so a stop meanwhile (body, mode) cancels it- if (mode === "sing") return void playDemo(DEMO_SONGS[0].name, useStore.getState().body, start);- await start();- const first = creatureById(creature)?.calls[0];- if (mode === "bestiary" && first) playCall(first.id);- else if (mode === "beatbox") setBeatPlaying(true);- else if (mode === "play") setHold(true);- }}- >- {starting ? "Starting…" : copy[1]}- </button>- {err ? <p className="error">Audio could not start: {err}. Reload the page and try again.</p> : <p className="hint">{copy[2]}</p>}- </div>- );-}-/** The body, in the head's header: three presets and the triangle between them. */function BodyControl() {const body = useStore((s) => s.body);@@ -179,28 +132,50 @@ function LeftScreen() {{bestiary ? <CreatureView /> : mode === "speak" ? <Face slots={speechSlots} info={speechInfo} overlay={speechWords} /> : mode === "sing" ? <Face info={singInfo} overlay={singWords} /> : mode === "beatbox" ? <Face slots={beatSlots} info={beatInfo} showFormants={false} /> : <Face />}</Suspense>{mode === "beatbox" && <BeatOverlay />}- <StartPrompt /></Screen>);}+/** Play's main button: breathe (the voice sounds while it's on), and Whisper beside it. */+function PlayActions() {+ const hold = useStore((s) => s.hold);+ const setHold = useStore((s) => s.setHold);+ const start = useStore((s) => s.start);+ const voiced = useStore((s) => s.source.voiced);+ const setSource = useStore((s) => s.setSource);+ const breathe = async () => {+ if (hold) return setHold(false);+ await start();+ if (useStore.getState().started) setHold(true);+ };+ return (+ <ActionBar label="Voice" onSpace={() => void breathe()}>+ <PrimaryButton label="Breathe" icon="breath" playing={hold} onClick={() => void breathe()} />+ <Chip on={!voiced} onClick={() => setSource({ voiced: !voiced })}>+ Whisper+ </Chip>+ </ActionBar>+ );+}+function PlayRight() {const f0 = useStore((s) => s.source.f0);return (<div className="right right-play">+ <PlayActions /><Screen className="s-tube" title="Tube" sub="Glottis to lips"><TubeView /></Screen><Screen className="s-folds" title="Vocal folds" sub="Slowed 100×"><Stroboscope /></Screen>- <Screen className="s-spec" title="Spectrum" sub="Resonances">+ <Screen className="s-spec" title="Spectrum"><SpectrumView /></Screen><Screen className="s-vowels" title="Vowels" sub="F1 / F2"><VowelMap /></Screen>- <Screen className="s-voice" title="Voice" tools={<VoiceToggles />}>+ <Screen className="s-voice" title="Voice"><VoiceControls /></Screen><Screen className="s-keys" title="Keys" sub={`${Math.round(f0)} Hz`} tools={<MidiButton />}>diff --git a/src/ui/components/ActionBar.tsx b/src/ui/components/ActionBar.tsxnew file mode 100644index 0000000..0c91874--- /dev/null+++ b/src/ui/components/ActionBar.tsx@@ -0,0 +1,50 @@+import { useEffect, useRef, type ReactNode } from "react";+import { useStore } from "../store.ts";++/**+ * The top of each tab's right column: the one bright button for what the tab is for, in the same+ * place on every tab, and the few settings that belong beside it. Its button starts the audio too+ * (there's no separate start step), and failing to start shows here. Space presses it, unless the+ * focus is in a field or on another control.+ */+export function ActionBar(props: { label: string; onSpace: () => void; children: ReactNode }) {+ const err = useStore((s) => s.startError);+ const onSpace = useRef(props.onSpace);+ onSpace.current = props.onSpace;+ useEffect(() => {+ const onKey = (e: KeyboardEvent) => {+ if (e.code !== "Space" || e.repeat || e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) return;+ // Space belongs to whatever has the focus: typing, a button, a dial, the body pad+ const t = e.target as Element | null;+ if (t && t !== document.body && t.closest("input, textarea, select, button, a, [contenteditable], [tabindex]")) return;+ e.preventDefault();+ onSpace.current();+ };+ window.addEventListener("keydown", onKey);+ return () => window.removeEventListener("keydown", onKey);+ }, []);+ return (+ <section className="screen action-bar" aria-label={props.label}>+ <div className="screen-body">+ <div className="act-row">{props.children}</div>+ {err && (+ <p className="act-error" role="alert">+ Audio could not start: {err}. Press again to retry.+ </p>+ )}+ </div>+ </section>+ );+}++/** The bright button (amber: it makes sound). While its sound plays it reads Stop. */+export function PrimaryButton(props: { label: string; playing?: boolean; busy?: string | null; icon?: "play" | "breath"; className?: string; onClick: () => void }) {+ const starting = useStore((s) => s.starting);+ const text = starting ? "Starting…" : props.busy ? props.busy : props.playing ? "Stop" : props.label;+ return (+ <button type="button" className={`act-primary${props.playing ? " on" : ""}${props.className ? " " + props.className : ""}`} onClick={props.onClick} disabled={starting || !!props.busy}>+ <span className={`act-icon ${props.playing ? "stop" : (props.icon ?? "play")}`} aria-hidden="true" />+ {text}+ </button>+ );+}diff --git a/src/ui/components/BeatboxPanel.tsx b/src/ui/components/BeatboxPanel.tsxindex 8213f01..0cfe2b4 100644--- a/src/ui/components/BeatboxPanel.tsx+++ b/src/ui/components/BeatboxPanel.tsx@@ -3,6 +3,8 @@ import { useStore } from "../store.ts";import { engine } from "../../audio/AudioEngine.ts";import { BEAT_SOUNDS, BEAT_PRESETS, formatBeat, parseBeat, type Airstream } from "../../wasm/engine.ts";import { Keys, MidiButton } from "./Keys.tsx";+import { ActionBar, PrimaryButton } from "./ActionBar.tsx";+import { Menu } from "./Controls.tsx";import { Chip, Screen } from "./Screen.tsx";import { EncoderPages } from "./Encoder.tsx";import { Spectrogram } from "./Spectrogram.tsx";@@ -132,14 +134,36 @@ function Sequencer() {);}-function Transport() {- const beat = useStore((s) => s.beat);- const setTempo = useStore((s) => s.setBeatTempo);+/** Beatbox's main button: play or stop the beat; the pattern and the close-mic effect beside it. */+function BeatActions() {+ const playing = useStore((s) => s.beat.playing);+ const preset = useStore((s) => s.beat.preset);const setPlaying = useStore((s) => s.setBeatPlaying);- const setSteps = useStore((s) => s.setBeatSteps);const loadPreset = useStore((s) => s.loadBeatPreset);const mic = useStore((s) => s.mic);const setMic = useStore((s) => s.setMic);+ const press = () => setPlaying(!playing);+ return (+ <ActionBar label="Beat" onSpace={press}>+ <PrimaryButton label="Play beat" playing={playing} onClick={press} />+ <Menu+ label="Pattern"+ value={preset ?? ""}+ options={[...(preset ? [] : [{ value: "", label: "Your beat", disabled: true }]), ...BEAT_PRESETS.map((p) => ({ value: p.name, label: p.name }))]}+ onChange={(name) => loadPreset(name)}+ />+ {/* an effect on the sound, not the microphone: "Close mic" read as "shut the mic" */}+ <Chip on={mic} onClick={() => setMic(!mic)} title="Close-mic effect: the bass, presence and squash of a mic held to the lips">+ Mic FX+ </Chip>+ </ActionBar>+ );+}++function Transport() {+ const beat = useStore((s) => s.beat);+ const setTempo = useStore((s) => s.setBeatTempo);+ const setSteps = useStore((s) => s.setBeatSteps);const [text, setText] = useState(() => formatBeat(beat.steps));const editing = useRef(false);useEffect(() => {@@ -147,14 +171,6 @@ function Transport() {}, [beat.steps]);return (<div className="transport">- <div className="transport-top">- <button className={`primary play${beat.playing ? " on" : ""}`} onClick={() => setPlaying(!beat.playing)} aria-pressed={beat.playing}>- {beat.playing ? "Stop" : "Play beat"}- </button>- <Chip on={mic} onClick={() => setMic(!mic)}>- Close mic- </Chip>- </div><div className="transport-encoders"><EncoderPageslabel="Transport"@@ -170,13 +186,6 @@ function Transport() {]}/></div>- <div className="examples presets" role="group" aria-label="Example beats">- {BEAT_PRESETS.map((p) => (- <Chip key={p.name} on={beat.preset === p.name} toggle={false} onClick={() => loadPreset(p.name)}>- {p.name}- </Chip>- ))}- </div><label className="sbn"><span className="dim">Beat as text</span><input@@ -200,24 +209,25 @@ function Transport() {);}-/** Beatbox mode's right column: the step sequencer, the waterfall, the pads, the transport, the keys (hum bass). */+/** Beatbox mode's right column: the beat button, the step sequencer, the waterfall, the pads, tempo and the beat as text, the keys (hum bass). */export function BeatboxRight() {- const beat = useStore((s) => s.beat);return (<div className="right right-beatbox">- <Screen className="s-seq" title="Step sequencer" sub={`${beat.preset ?? "Your beat"} / ${beat.bpm} bpm`}>+ <BeatActions />+ <Screen className="s-seq" title="Step sequencer"><Sequencer /></Screen>- <Screen className="s-wf" title="Spectrogram" sub="Last two seconds / newest in front">+ <Screen className="s-wf" title="Spectrogram"><Spectrogram /></Screen>- <Screen className="s-pads" title="Pads" sub="Keys 1 to 0">+ <Screen className="s-pads" title="Pads"><Pads /></Screen>- <Screen className="s-transport" title="Transport">+ <Screen className="s-transport" title="Tempo"><Transport /></Screen>- <Screen className="s-keys s-keys-compact" title="Keys" sub="Hum a bass note" tools={<MidiButton />}>+ {/* the keys hum a bass note under the beat */}+ <Screen className="s-keys s-keys-compact" title="Bass" tools={<MidiButton />}><Keys /></Screen></div>diff --git a/src/ui/components/BestiaryPanel.tsx b/src/ui/components/BestiaryPanel.tsxindex c73a0a1..ef2ccd4 100644--- a/src/ui/components/BestiaryPanel.tsx+++ b/src/ui/components/BestiaryPanel.tsx@@ -1,9 +1,11 @@-import { memo } from "react";+import { memo, useState } from "react";import { useStore } from "../store.ts";import { CREATURES, creatureById } from "../../wasm/engine.ts";import type { CreatureDef } from "../../wasm/types.ts";import { useLiveCreature } from "../creatureLive.ts";import { Keys, MidiButton } from "./Keys.tsx";+import { ActionBar } from "./ActionBar.tsx";+import { Menu } from "./Controls.tsx";import { Chip, Screen } from "./Screen.tsx";import { EncoderPages, type EncoderPage } from "./Encoder.tsx";import { Spectrogram } from "./Spectrogram.tsx";@@ -42,38 +44,49 @@ function Gallery() {);}-function Calls({ def }: { def: CreatureDef }) {+/**+ * Bestiary's main buttons: the animal's calls (each one plays it; the one sounding is lit), and+ * Breathe, which keeps the breath on to shape the sound with the controls. Space replays the last+ * call. (The animal's description is written under its name, on the creature screen.)+ */+function CallActions({ def }: { def: CreatureDef }) {const playCall = useStore((s) => s.playCall);+ const starting = useStore((s) => s.starting);const hold = useStore((s) => s.hold);const setHold = useStore((s) => s.setHold);- const keyCall = useStore((s) => s.keyCall);- const setKeyCall = useStore((s) => s.setKeyCall);const live = useLiveCreature(def.id);+ const [last, setLast] = useState<string | null>(null);+ const play = (id: string) => {+ setLast(id);+ playCall(id);+ };+ const again = def.calls.find((c) => c.id === last) ?? def.calls[0];return (- <div className="calls-body">- <div className="calls">- {def.calls.map((c) => (- <button key={c.id} className={`call${live?.call === c.id ? " playing" : ""}`} onClick={() => playCall(c.id)} title={c.hint}>- <span className="call-name">{c.name}</span>- </button>- ))}- <button className={`call sustain${hold ? " on" : ""}`} onClick={() => setHold(!hold)} aria-pressed={hold} title="Keep the breath on and shape the sound with the controls">- <span className="call-name">{hold ? "Stop sustaining" : "Sustain"}</span>+ <ActionBar label="Calls" onSpace={() => again && play(again.id)}>+ {def.calls.map((c) => (+ <button key={c.id} type="button" className={`act-primary act-call${live?.call === c.id ? " on" : ""}`} onClick={() => play(c.id)} disabled={starting} title={c.hint}>+ <span className="act-icon play" aria-hidden="true" />+ {c.name}</button>- </div>- <div className="keys-mode" role="radiogroup" aria-label="What the keys play">- <span className="dim">Keys play</span>- <Chip toggle={false} role="radio" aria-checked={keyCall === null} on={keyCall === null} onClick={() => setKeyCall(null)}>- Held voice- </Chip>- {def.calls.map((c) => (- <Chip key={c.id} toggle={false} role="radio" aria-checked={keyCall === c.id} on={keyCall === c.id} onClick={() => setKeyCall(c.id)}>- {c.name}- </Chip>- ))}- </div>- <p className="creature-blurb">{def.blurb}</p>- </div>+ ))}+ <Chip on={hold} onClick={() => setHold(!hold)} title="Keep the breath on and shape the sound with the controls">+ Breathe+ </Chip>+ </ActionBar>+ );+}++/** What the keys play: the held voice at the key's pitch, or one of the calls. */+function KeysMode({ def }: { def: CreatureDef }) {+ const keyCall = useStore((s) => s.keyCall);+ const setKeyCall = useStore((s) => s.setKeyCall);+ return (+ <Menu+ label="What the keys play"+ value={keyCall ?? ""}+ options={[{ value: "", label: "Held voice" }, ...def.calls.map((c) => ({ value: c.id, label: c.name }))]}+ onChange={(id) => setKeyCall(id || null)}+ />);}@@ -107,28 +120,26 @@ function Params({ def }: { def: CreatureDef }) {);}-/** Bestiary's right column: the creatures, the waterfall, the calls, the controls, the airway, the keys. */+/** Bestiary's right column: the calls, the creatures, the waterfall, the controls, the airway, the keys. */export function BestiaryRight() {const creature = useStore((s) => s.creature);const def = creatureById(creature);return (<div className="right right-bestiary">- <Screen className="s-gallery" title="Creatures" sub={`${CREATURES.length} specimens`}>+ {def && <CallActions def={def} />}+ <Screen className="s-gallery" title="Creatures"><Gallery /></Screen>- <Screen className="s-wf" title="Spectrogram" sub="Waterfall of the call">+ <Screen className="s-wf" title="Spectrogram"><Spectrogram /></Screen>- <Screen className="s-calls" title="Calls">- {def && <Calls def={def} />}- </Screen><Screen className="s-cparams" title="Controls">{def && <Params def={def} />}</Screen><Screen className="s-airway" title="Airway" sub="Each tube unrolled"><CreatureTubes /></Screen>- <Screen className="s-keys s-keys-compact" title="Keys" sub="The held voice or a call, at the key's pitch" tools={<MidiButton />}>+ <Screen className="s-keys s-keys-compact" title="Keys" tools={<>{def && <KeysMode def={def} />}<MidiButton /></>}><Keys /></Screen></div>diff --git a/src/ui/components/Controls.tsx b/src/ui/components/Controls.tsxindex e290932..989825d 100644--- a/src/ui/components/Controls.tsx+++ b/src/ui/components/Controls.tsx@@ -55,3 +55,24 @@ export function Segmented<T extends string>(props: { value: T | null; options: {</div>);}++/** A choice of a few named things (a song, a pattern), as a native select in the vector look. */+export function Menu<T extends string>(props: { label: string; value: T; options: { value: T; label: string; disabled?: boolean }[]; onChange: (v: T) => void; icon?: "note" }) {+ return (+ <span className={`menu${props.icon ? " with-icon" : ""}`}>+ {props.icon === "note" && (+ <svg className="menu-icon" viewBox="0 0 12 16" width="10" height="14" aria-hidden="true">+ <ellipse cx="3.6" cy="12.4" rx="3.2" ry="2.4" fill="currentColor" />+ <path d="M6.6 12.4V1.5l4.4 2.6" fill="none" stroke="currentColor" strokeWidth="1.4" />+ </svg>+ )}+ <select aria-label={props.label} value={props.value} onChange={(e) => props.onChange(e.target.value as T)}>+ {props.options.map((o) => (+ <option key={o.value} value={o.value} disabled={o.disabled}>+ {o.label}+ </option>+ ))}+ </select>+ </span>+ );+}diff --git a/src/ui/components/CreatureView.tsx b/src/ui/components/CreatureView.tsxindex f9b8860..f25e062 100644--- a/src/ui/components/CreatureView.tsx+++ b/src/ui/components/CreatureView.tsx@@ -100,7 +100,11 @@ export function CreatureView() {const tele = live ?? previewTelemetry(def, st.cparams[def.id]);// a narrow screen (a phone) stacks the title and status, and puts the readouts two by twoconst compact = w < 560;- const top = compact ? 96 : 64, slotH = compact ? 132 : Math.min(118, h * 0.2);+ // what the animal is, under its name (its place in the right column went to the calls)+ const blurbO = { size: 10, color: TEXT.secondary, ls: 0.08 };+ const blurb = wrapLabel(ctx, def.blurb, Math.min(w - 36, 460), blurbO);+ const blurbY = compact ? 90 : 76, blurbH = blurb.length * 15;+ const top = (compact ? 96 : 64) + blurbH, slotH = compact ? 132 : Math.min(118, h * 0.2);const vw = vis.view.x1 - vis.view.x0, vh = vis.view.y1 - vis.view.y0;const sc = Math.min((w * 0.86) / vw, ((h - top - slotH) * 0.9) / vh);const ox = w / 2 - ((vis.view.x0 + vis.view.x1) / 2) * sc;@@ -189,6 +193,7 @@ export function CreatureView() {// like a map's title: the name, the latin name, and what it is doinglabel(ctx, fit(ctx, def.name.toUpperCase(), w - 32, compact ? 18 : 24, 0.18), 16, compact ? 30 : 34, { size: compact ? 18 : 24, color: TEXT.primary, ls: 0.18 });label(ctx, fit(ctx, def.latin.toUpperCase(), w - 34, 10, 0.16), 18, compact ? 48 : 54, { size: 10, color: TEXT.secondary, ls: 0.16 });+ blurb.forEach((line, i) => label(ctx, line, 18, blurbY + i * 15, blurbO));const state = live ? (live.call ? (def.calls.find((c) => c.id === live.call)?.name ?? live.call) : live.gate > 0.05 ? "Sustaining" : "At rest") : "Not started";const pitchText = pp ? (() => { const f = fmtParam(pitch, pp); return `${f.value} ${f.unit}`.trim().toUpperCase(); })() : "";if (compact) {diff --git a/src/ui/components/SingPanel.tsx b/src/ui/components/SingPanel.tsxindex efa0b86..27ec43b 100644--- a/src/ui/components/SingPanel.tsx+++ b/src/ui/components/SingPanel.tsx@@ -1,9 +1,11 @@-import { useEffect } from "react";+import { useEffect, useState } from "react";import { useStore } from "../store.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, MidiButton } from "./Keys.tsx";+import { ActionBar, PrimaryButton } from "./ActionBar.tsx";+import { Menu } from "./Controls.tsx";import { PianoRoll } from "./PianoRoll.tsx";import { SpectrumView } from "./SpectrumView.tsx";import { Chip, Screen } from "./Screen.tsx";@@ -112,32 +114,32 @@ function SongControls() {);}-function DemoSongs() {- const body = useStore((s) => s.body);+/** Sing's main button: sing the chosen song (its own words), or stop it. */+function SingActions() {const start = useStore((s) => s.start);const demo = useSing((s) => s.demo);+ const [song, setSong] = useState(DEMO_SONGS[0].name);+ // playDemo waits for the audio itself, so a stop meanwhile (body, mode) cancels it+ const sing = (name: string) => void playDemo(name, useStore.getState().body, start);+ const press = () => (demo ? stopSinging() : sing(song));return (- <div className="demo-songs" role="group" aria-label="Demo songs">- {DEMO_SONGS.map((s) => (- <Chip- key={s.name}- on={demo === s.name}- onClick={async () => {- if (demo === s.name) {- stopSinging();- return;- }- await playDemo(s.name, body, start);- }}- >- {demo === s.name ? `Stop “${s.name}”` : s.name}- </Chip>- ))}- </div>+ <ActionBar label="Song" onSpace={press}>+ <PrimaryButton label="Sing" playing={!!demo} onClick={press} />+ <Menu+ label="Song"+ icon="note"+ value={demo ?? song}+ options={DEMO_SONGS.map((s) => ({ value: s.name, label: s.name }))}+ onChange={(name) => {+ setSong(name);+ if (demo) sing(name);+ }}+ />+ </ActionBar>);}-/** Sing mode's right column: the piano roll, the lyrics, the spectrum with the ring, the song voice, the keys. */+/** Sing mode's right column: the song button, the pitch 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@@ -146,10 +148,11 @@ export function SingRight() {const next = useSing((s) => (s.demo ? null : (s.syllables[s.cursor]?.text ?? null)));return (<div className="right right-sing">- <Screen className="s-roll" title="Piano roll" sub="Notes and the pitch sung">+ <SingActions />+ <Screen className="s-roll" title="Pitch"><PianoRoll /></Screen>- <Screen className="s-lyrics" title="Lyrics" sub="Each note sings the next syllable" tools={<DemoSongs />}>+ <Screen className="s-lyrics" title="Lyrics"><Lyrics /></Screen><Screen className="s-spec" title="Spectrum" sub={ring ? "Ring on" : ""}>diff --git a/src/ui/components/SpeakPanel.tsx b/src/ui/components/SpeakPanel.tsxindex 5bb8ee5..15cab59 100644--- a/src/ui/components/SpeakPanel.tsx+++ b/src/ui/components/SpeakPanel.tsx@@ -1,10 +1,11 @@import { useEffect, useState } from "react";import { useStore } from "../store.ts";-import { speakText, speakPhrases, stopSpeaking, onPlan, currentPlan, spokenWordNow } from "../speech.ts";+import { speakText, speakPhrases, stopSpeaking, onPlan, currentPlan, spokenWordNow, speakingNow } from "../speech.ts";import { mouthWords } from "../mouthWords.ts";import { tokenizeIpa } from "../../wasm/engine.ts";-import { Slider, Toggle } from "./Controls.tsx";+import { Slider } from "./Controls.tsx";import { Chip, Screen } from "./Screen.tsx";+import { ActionBar, PrimaryButton } from "./ActionBar.tsx";import { ScoreView, planNow } from "./ScoreView.tsx";import { TubeView } from "./TubeView.tsx";import { Stroboscope } from "./Stroboscope.tsx";@@ -112,7 +113,22 @@ function ConsonantChart(props: { onPad: (c: string) => void }) {);}-/** Speak mode's right column: what to say, the gestural score, the consonant chart, the tube and folds. */+/** Whether speech is sounding, polled each frame (re-renders only when it changes). */+function useSpeaking(): boolean {+ const [on, setOn] = useState(false);+ useEffect(() => {+ let raf = 0;+ const loop = () => {+ setOn(speakingNow());+ raf = requestAnimationFrame(loop);+ };+ raf = requestAnimationFrame(loop);+ return () => cancelAnimationFrame(raf);+ }, []);+ return on;+}++/** Speak mode's right column: the speak button, what to say, the gestural score, the consonant chart, the tube and folds. */export function SpeakRight() {const body = useStore((s) => s.body);const f0 = useStore((s) => s.source.f0);@@ -123,6 +139,7 @@ export function SpeakRight() {const [busy, setBusy] = useState(false);const [trans, setTrans] = useState(currentPlan()?.transcription ?? "");const [vowel, setVowel] = useState("ɑ");+ const speaking = useSpeaking();useEffect(() => onPlan((p) => setTrans(p?.transcription ?? "")), []);const speak = async () => {@@ -139,9 +156,20 @@ export function SpeakRight() {speakPhrases([{ segments: tokenizeIpa(`ˈ${vowel}${c}${vowel}`), intonation: "flat" }], { body, rate, f0 });};+ const press = () => (speaking ? stopSpeaking() : void speak());+return (<div className="right right-speak">- <Screen className="s-say" title="Say" sub="Text to speech" tools={<Toggle label="Text is IPA" checked={ipa} onChange={setIpa} />}>+ <ActionBar label="Speak" onSpace={press}>+ <PrimaryButton label="Speak" playing={speaking} busy={busy ? "Preparing…" : null} onClick={press} />+ <div className="act-slider">+ <Slider label="Rate" value={rate} min={0.5} max={1.8} onChange={setRate} format={(v) => `${v.toFixed(2)}×`} />+ </div>+ <Chip on={ipa} onClick={() => setIpa(!ipa)}>+ Text is IPA+ </Chip>+ </ActionBar>+ <Screen className="s-say" label="What to say"><div className="say"><div className="say-row"><textarea@@ -156,22 +184,11 @@ export function SpeakRight() {aria-label={ipa ? "IPA to speak" : "Text to speak"}placeholder={ipa ? "Type IPA, for example ˈhɛloʊ" : "Type something for the voice to say"}/>- <div className="say-actions">- <button className="primary" onClick={() => void speak()} disabled={busy}>- {busy ? "Preparing…" : "Speak"}- </button>- <button className="ghost" onClick={stopSpeaking}>- Stop- </button>- </div></div><div className="say-row"><p className="transcription" aria-live="polite">- {trans ? `/${trans}/` : "The transcription appears here."}+ {trans ? `/${trans}/` : ""}</p>- <div className="say-rate">- <Slider label="Rate" value={rate} min={0.5} max={1.8} onChange={setRate} format={(v) => `${v.toFixed(2)}×`} />- </div></div><div className="examples" role="group" aria-label="Examples">{EXAMPLES.map((ex) => (diff --git a/src/ui/components/VoiceControls.tsx b/src/ui/components/VoiceControls.tsxindex b294e2e..e06ac92 100644--- a/src/ui/components/VoiceControls.tsx+++ b/src/ui/components/VoiceControls.tsx@@ -1,6 +1,5 @@import { useStore } from "../store.ts";import { EncoderPages, type EncoderPage } from "./Encoder.tsx";-import { Chip } from "./Screen.tsx";const NOTE = ["C", "C♯", "D", "D♯", "E", "F", "F♯", "G", "G♯", "A", "A♯", "B"];export const noteName = (f: number) => {@@ -72,21 +71,3 @@ export function VoiceControls() {];return <EncoderPages label="Voice" pages={pages} />;}--/** Hold breath and Whisper, for the voice screen's header. */-export function VoiceToggles() {- const voiced = useStore((st) => st.source.voiced);- const setSource = useStore((st) => st.setSource);- const hold = useStore((st) => st.hold);- const setHold = useStore((st) => st.setHold);- return (- <>- <Chip on={hold} onClick={() => setHold(!hold)}>- Hold breath- </Chip>- <Chip on={!voiced} onClick={() => setSource({ voiced: !voiced })}>- Whisper- </Chip>- </>- );-}diff --git a/src/ui/speech.ts b/src/ui/speech.tsindex 16630c2..a94d8d5 100644--- a/src/ui/speech.ts+++ b/src/ui/speech.ts@@ -80,6 +80,15 @@ export function stopSpeaking(): void {if (current) cutId = current.id;}+/** Whether an utterance is sounding: scheduled (or waiting for the worklet) and not over or stopped. */+export function speakingNow(): boolean {+ const p = current;+ if (!p || p.id === cutId) return false;+ const t = engine.voiceClock();+ if (p.offset === null || t === null) return true;+ return t - p.offset < p.plan.end;+}+/** The word being spoken now (null between words and once the speech is over or stopped). */export function spokenWordNow(): { key: string; text: string } | null {const p = current;diff --git a/src/ui/styles.css b/src/ui/styles.cssindex a0157a2..c2c5c49 100644--- a/src/ui/styles.css+++ b/src/ui/styles.css@@ -255,36 +255,6 @@ button.primary.large {color: var(--text-dim);}-.start-prompt {- position: absolute;- left: 50%;- top: 50%;- transform: translate(-50%, -50%);- max-width: 360px;- padding: 22px 24px;- background: rgba(10, 12, 14, 0.82);- border: 1px solid var(--line);- border-radius: var(--radius-m);- text-align: center;- backdrop-filter: blur(3px);-}--.start-prompt p {- margin: 0 0 14px;-}--.start-prompt .hint {- margin: 14px 0 0;- color: var(--text-dim);- font-size: 14px;-}--.start-prompt .error {- margin: 14px 0 0;- color: #ffb4a0;- font-size: 14px;-}-.panel h2 {font-size: 13px;font-weight: 550;@@ -429,14 +399,6 @@ input[type="range"]::-moz-range-thumb {border-color: var(--text-dim);}-button.ghost {- background: transparent;- border: 1px solid var(--line);- border-radius: var(--radius-s);- padding: 7px 14px;- cursor: pointer;-}-.transcription {margin: 0;font-size: 17px;@@ -586,70 +548,6 @@ button.ghost {line-height: 1.3;}-.calls {- display: grid;- grid-template-columns: 1fr 1fr;- gap: 6px;-}--.call {- display: flex;- flex-direction: column;- gap: 2px;- padding: 8px 10px 9px;- border: 1px solid var(--line);- border-radius: var(--radius-s);- background: var(--black);- text-align: left;- cursor: pointer;-}--.call:hover {- border-color: var(--text-dim);-}--.call:active,-.call.sustain.on {- background: var(--caliper);- border-color: var(--caliper);- color: #1d1a10;-}--.call.playing {- border-color: var(--caliper);-}--.call.playing .call-name {- color: var(--caliper);-}--.call.sustain {- grid-column: 1 / -1;-}--.call-name {- font-weight: 600;- font-size: 14px;-}--.keys-mode {- display: flex;- flex-wrap: wrap;- align-items: center;- gap: 6px;-}--.keys-mode .dim {- margin-right: 2px;-}--.creature-blurb {- margin: 4px 0 10px;- font-size: 13px;- color: var(--text-dim);- max-width: 62ch;-}-/* ---------- sing */.sing {display: grid;@@ -797,14 +695,6 @@ button.ghost {flex-wrap: wrap;}-.transport .play {- min-width: 104px;-}--.transport .play.on {- background: #ffd15c;-}-.seq-grid {display: flex;flex-direction: column;@@ -1267,7 +1157,6 @@ body {/* ---------- buttons, chips */button.primary,-button.ghost,.chip {appearance: none;background: transparent;@@ -1296,7 +1185,6 @@ button.primary.large {padding: 10px 18px;}-button.ghost:hover,.chip:hover {color: var(--text);border-color: var(--blue-dim);@@ -1330,8 +1218,8 @@ button.ghost:hover,.right-play {grid-template-columns: minmax(0, 284fr) minmax(0, 58fr) minmax(0, 342fr);- grid-template-rows: minmax(min-content, 200fr) minmax(min-content, 200fr) auto minmax(min-content, 172fr);- grid-template-areas: "tube tube folds" "spec spec spec" "vowels voice voice" "keys keys keys";+ grid-template-rows: auto minmax(min-content, 200fr) minmax(min-content, 200fr) auto minmax(min-content, 172fr);+ grid-template-areas: "act act act" "tube tube folds" "spec spec spec" "vowels voice voice" "keys keys keys";}.s-tube { grid-area: tube; }@@ -1341,6 +1229,168 @@ button.ghost:hover,.s-voice { grid-area: voice; }.s-keys { grid-area: keys; }+/* ---------- the action bar: each tab's one bright button, in the same place at the top of the+ right column, with the few settings that belong beside it */+.action-bar {+ grid-area: act;+ border-color: var(--blue-dim);+}++/* .right: above the narrow layouts' floors for every screen in the column, set further down */+.right .action-bar .screen-body {+ min-height: 0;+ padding: 8px 12px;+ gap: 6px;+}++.act-row {+ display: flex;+ flex-wrap: wrap;+ align-items: center;+ gap: 10px 14px;+}++/* amber: it makes sound */+.act-primary {+ appearance: none;+ display: inline-flex;+ align-items: center;+ gap: 12px;+ min-height: 44px;+ padding: 9px 24px 9px 18px;+ background: rgba(255, 179, 64, 0.08);+ border: 1.5px solid var(--amber);+ border-radius: 0;+ color: #fff4dc;+ font-family: var(--font);+ font-weight: 400;+ font-size: 17px;+ letter-spacing: 0.16em;+ text-transform: uppercase;+ text-shadow: 0 0 6px rgba(255, 179, 64, 0.55);+ box-shadow: 0 0 10px rgba(255, 179, 64, 0.3), inset 0 0 8px rgba(255, 179, 64, 0.12);+ cursor: pointer;+}++.act-primary:hover {+ background: rgba(255, 179, 64, 0.14);+}++.act-primary.on {+ background: rgba(255, 179, 64, 0.22);+}++.act-primary:disabled {+ opacity: 0.6;+ cursor: progress;+}++.act-icon {+ flex: none;+ width: 13px;+ height: 15px;+ background: var(--amber);+}++.act-icon.play {+ clip-path: polygon(0 0, 100% 50%, 0 100%);+}++.act-icon.stop {+ height: 13px;+}++.act-icon.breath {+ height: 13px;+ border-radius: 50%;+}++/* a creature's calls: several sound buttons side by side, the one sounding lit */+.act-call {+ min-height: 40px;+ padding: 8px 14px 8px 11px;+ gap: 8px;+ font-size: 12px;+ letter-spacing: 0.12em;+ background: transparent;+ box-shadow: none;+}++.act-call .act-icon {+ width: 9px;+ height: 11px;+}++.act-call.on {+ background: rgba(255, 179, 64, 0.2);+ box-shadow: 0 0 10px rgba(255, 179, 64, 0.35);+}++.act-slider {+ width: 200px;+}++.act-error {+ margin: 0;+ font-size: 11px;+ line-height: 1.5;+ letter-spacing: 0.06em;+ color: var(--red);+}++/* a menu (a song, a pattern, what the keys play): a native select in the vector look */+.menu {+ display: inline-flex;+ align-items: center;+ gap: 2px;+ border: 1px solid var(--blue-dim);+ background: #000;+}++.menu:hover,+.menu:focus-within {+ border-color: var(--blue);+}++.menu:has(select:focus-visible) {+ outline: 2px solid var(--caliper);+ outline-offset: 2px;+}++.menu-icon {+ flex: none;+ margin-left: 10px;+ color: var(--blue);+}++.menu select {+ appearance: none;+ min-height: 34px;+ padding: 6px 30px 6px 10px;+ background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 6'%3E%3Cpath d='M.5.5l4 4 4-4' fill='none' stroke='%234fb6f2' stroke-width='1.2'/%3E%3C/svg%3E") no-repeat right 11px center / 9px 6px;+ border: 0;+ border-radius: 0;+ outline: none;+ color: var(--text);+ font-family: var(--font);+ font-size: 12px;+ letter-spacing: 0.14em;+ text-transform: uppercase;+ cursor: pointer;+}++.menu option {+ background: #000;+ color: var(--text);+}++.screen-tools .menu select {+ min-height: 0;+ padding: 2px 22px 2px 8px;+ font-size: 9px;+ background-position: right 7px center;+}+.midi-chip {max-width: 220px;overflow: hidden;@@ -1491,30 +1541,6 @@ button.ghost:hover,}/* the start prompt, over the left screen */-.start-prompt {- background: rgba(0, 0, 0, 0.88);- border: 1px solid var(--blue-dim);- border-radius: 0;- backdrop-filter: none;- max-width: 380px;- padding: 22px 26px;- box-shadow: 0 0 10px rgba(79, 182, 242, 0.15);-}--.start-prompt p {- font-size: 12px;- line-height: 1.6;- color: var(--text-dim);-}--.start-prompt .hint {- font-size: 11px;- color: var(--text-dim);-}--.start-prompt .error {- color: var(--red);-}/* ---------- encoders (OP-1 style) */.enc-pages {@@ -1726,7 +1752,6 @@ input[type="text"],.slider label,.toggle,-.call-name,.pad-name,.specimen-name {text-transform: uppercase;@@ -1790,7 +1815,7 @@ input[type="range"]::-moz-range-thumb {grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);grid-template-rows: none;grid-auto-rows: auto;- grid-template-areas: "tube folds" "spec spec" "vowels vowels" "voice voice" "keys keys";+ grid-template-areas: "act act" "tube folds" "spec spec" "vowels vowels" "voice voice" "keys keys";}.right-play .screen-body {min-height: 190px;@@ -1812,7 +1837,7 @@ input[type="range"]::-moz-range-thumb {}.right-play {grid-template-columns: minmax(0, 1fr);- grid-template-areas: "tube" "folds" "spec" "vowels" "voice" "keys";+ grid-template-areas: "act" "tube" "folds" "spec" "vowels" "voice" "keys";}.left .screen-body {min-height: 118vw;@@ -1826,11 +1851,18 @@ input[type="range"]::-moz-range-thumb {/* ---------- Speak */.right-speak {grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);- grid-template-rows: auto minmax(min-content, 236fr) auto minmax(min-content, 190fr);- grid-template-areas: "say say" "score score" "chart chart" "tube folds";+ grid-template-rows: auto auto minmax(min-content, 236fr) auto minmax(min-content, 190fr);+ grid-template-areas: "act act" "say say" "score score" "chart chart" "tube folds";}.s-say { grid-area: say; }++/* the tube and folds' floor sets how tall the score is in a short window (rows of canvases share+ by fr from their floors): lower, so the speak button above them fits a 1280 x 800 window */+.right-speak .s-tube .screen-body,+.right-speak .s-folds .screen-body {+ min-height: 96px;+}.s-score { grid-area: score; }.s-chart { grid-area: chart; }@@ -1865,16 +1897,6 @@ input[type="range"]::-moz-range-thumb {box-shadow: 0 0 5px rgba(79, 182, 242, 0.25);}-.say-actions {- display: flex;- flex-direction: column;- gap: 6px;-}--.say-actions button {- min-width: 84px;-}-.say .transcription {flex: 1;min-width: 0;@@ -1888,20 +1910,6 @@ input[type="range"]::-moz-range-thumb {white-space: nowrap;}-.say-rate {- width: 170px;- flex: none;-}--.say-rate .slider label {- font-size: 9px;- margin: 0;-}--.say-rate input[type="range"] {- height: 12px;-}-.say .examples {display: flex;flex-wrap: nowrap;@@ -2027,7 +2035,7 @@ input[type="range"]::-moz-range-thumb {@media (max-width: 1100px) {.right-speak {grid-template-rows: none;- grid-template-areas: "say say" "score score" "chart chart" "tube folds";+ grid-template-areas: "act act" "say say" "score score" "chart chart" "tube folds";}.right-speak .screen-body {min-height: 200px;@@ -2040,7 +2048,7 @@ input[type="range"]::-moz-range-thumb {@media (max-width: 640px) {.right-speak {grid-template-columns: minmax(0, 1fr);- grid-template-areas: "say" "score" "chart" "tube" "folds";+ grid-template-areas: "act" "say" "score" "chart" "tube" "folds";}.s-say .screen-body {min-height: 230px;@@ -2048,9 +2056,6 @@ input[type="range"]::-moz-range-thumb {.say-row {flex-wrap: wrap;}- .say-actions {- flex-direction: row;- }/* room to wrap here, rather than cut the transcription short */.say .transcription {white-space: normal;@@ -2058,10 +2063,12 @@ input[type="range"]::-moz-range-thumb {}/* ---------- Sing */+/* the pitch roll only shows what was sung: a smaller share than it had, so the song's button+ above it fits a 1280 x 800 window and the keys keep their room */.right-sing {grid-template-columns: minmax(0, 342fr) minmax(0, 342fr);- grid-template-rows: minmax(min-content, 320fr) auto auto minmax(min-content, 172fr);- grid-template-areas: "roll roll" "lyrics lyrics" "spec voice" "keys keys";+ grid-template-rows: auto minmax(min-content, 240fr) auto auto minmax(min-content, 172fr);+ grid-template-areas: "act act" "roll roll" "lyrics lyrics" "spec voice" "keys keys";}.s-roll { grid-area: roll; }@@ -2071,17 +2078,6 @@ input[type="range"]::-moz-range-thumb {height: 100%;}-.demo-songs {- display: flex;- flex-wrap: wrap;- gap: 4px;-}--.demo-songs .chip {- padding: 2px 8px;- font-size: 9px;-}-.lyrics {padding: 6px 14px 10px;display: grid;@@ -2089,6 +2085,11 @@ input[type="range"]::-moz-range-thumb {gap: 8px;}+/* as tall as the words: the song's button above took the room the old floor held empty */+.s-lyrics .screen-body {+ min-height: 0;+}+.lyrics textarea {height: 30px;resize: none;@@ -2171,7 +2172,7 @@ input[type="range"]::-moz-range-thumb {@media (max-width: 1100px) {.right-sing {grid-template-rows: none;- grid-template-areas: "roll roll" "lyrics lyrics" "spec voice" "keys keys";+ grid-template-areas: "act act" "roll roll" "lyrics lyrics" "spec voice" "keys keys";}.right-sing .screen-body {min-height: 190px;@@ -2187,15 +2188,15 @@ input[type="range"]::-moz-range-thumb {@media (max-width: 640px) {.right-sing {grid-template-columns: minmax(0, 1fr);- grid-template-areas: "roll" "lyrics" "spec" "voice" "keys";+ grid-template-areas: "act" "roll" "lyrics" "spec" "voice" "keys";}}/* ---------- Beatbox */.right-beatbox {grid-template-columns: minmax(0, 392fr) minmax(0, 292fr);- grid-template-rows: minmax(min-content, 236fr) minmax(min-content, 176fr) auto auto;- grid-template-areas: "seq seq" "wf wf" "pads transport" "keys keys";+ grid-template-rows: auto minmax(min-content, 236fr) minmax(min-content, 176fr) auto auto;+ grid-template-areas: "act act" "seq seq" "wf wf" "pads transport" "keys keys";}.s-seq { grid-area: seq; }@@ -2374,20 +2375,6 @@ input[type="range"]::-moz-range-thumb {margin: 0;}-.transport-top {- display: flex;- gap: 6px;- align-items: center;-}--.transport-top .play.on {- background: transparent;- border-color: var(--amber);- color: var(--amber);- box-shadow: 0 0 6px rgba(255, 179, 64, 0.4);- text-shadow: 0 0 3px rgba(255, 179, 64, 0.6);-}-.transport-encoders {display: flex;flex-direction: column;@@ -2405,17 +2392,6 @@ input[type="range"]::-moz-range-thumb {font-size: 22px;}-.transport .presets {- display: flex;- flex-wrap: wrap;- gap: 4px;-}--.transport .presets .chip {- padding: 2px 7px;- font-size: 9px;-}-.transport .sbn {display: flex;align-items: center;@@ -2492,7 +2468,7 @@ input[type="range"]::-moz-range-thumb {.right-beatbox {grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);grid-template-rows: none;- grid-template-areas: "seq seq" "wf wf" "pads transport" "keys keys";+ grid-template-areas: "act act" "seq seq" "wf wf" "pads transport" "keys keys";}.right-beatbox .screen-body {min-height: 200px;@@ -2512,7 +2488,7 @@ input[type="range"]::-moz-range-thumb {@media (max-width: 640px) {.right-beatbox {grid-template-columns: minmax(0, 1fr);- grid-template-areas: "seq" "wf" "pads" "transport" "keys";+ grid-template-areas: "act" "seq" "wf" "pads" "transport" "keys";}.beat-overlay {top: 10px;@@ -2520,14 +2496,15 @@ input[type="range"]::-moz-range-thumb {}/* ---------- Bestiary */+/* the calls take the top (the action bar), so the waterfall and the airway share a row to keep+ the column the height it was */.right-bestiary {grid-template-columns: minmax(0, 342fr) minmax(0, 342fr);- grid-template-rows: minmax(min-content, 196fr) minmax(min-content, 196fr) auto minmax(min-content, 150fr) auto;- grid-template-areas: "gallery gallery" "wf wf" "calls cparams" "airway airway" "keys keys";+ grid-template-rows: auto minmax(min-content, 196fr) minmax(min-content, 196fr) auto auto;+ grid-template-areas: "act act" "gallery gallery" "wf airway" "cparams cparams" "keys keys";}.s-gallery { grid-area: gallery; }-.s-calls { grid-area: calls; }.s-cparams { grid-area: cparams; }.s-airway { grid-area: airway; }@@ -2599,89 +2576,6 @@ input[type="range"]::-moz-range-thumb {max-width: 100%;}-.calls-body {- position: absolute;- inset: 0;- padding: 4px 14px 10px;- display: flex;- flex-direction: column;- gap: 8px;- overflow-y: auto;-}--.calls-body .calls {- display: flex;- flex-wrap: wrap;- gap: 5px;-}--.calls-body .call {- background: transparent;- border: 1px solid var(--frame);- border-radius: 0;- padding: 4px 10px;- color: var(--text);- text-align: left;- cursor: pointer;-}--.calls-body .call:hover {- border-color: var(--blue-dim);- color: var(--text);-}--.calls-body .call-name {- font-size: 10px;- font-weight: 300;- letter-spacing: 0.14em;- text-transform: uppercase;-}--.calls-body .call.playing {- border-color: var(--amber);- color: var(--amber);- box-shadow: 0 0 6px rgba(255, 179, 64, 0.45);- text-shadow: 0 0 3px rgba(255, 179, 64, 0.6);-}--.calls-body .call.playing .call-name {- color: var(--amber);-}--.calls-body .call.sustain.on {- border-color: var(--blue);- color: var(--text);- background: transparent;-}--.calls-body .keys-mode {- display: flex;- flex-wrap: wrap;- gap: 4px;- align-items: center;-}--.calls-body .keys-mode .dim {- font-size: 8px;- letter-spacing: 0.14em;- text-transform: uppercase;- color: var(--text-dim);- margin-right: 4px;-}--.calls-body .keys-mode .chip {- padding: 2px 7px;- font-size: 9px;-}--.calls-body .creature-blurb {- margin: 0;- font-size: 10px;- line-height: 1.5;- letter-spacing: 0.04em;- color: var(--text-dim);-}-.cparams-role {margin: 2px 14px 0;font-size: 9px;@@ -2699,7 +2593,7 @@ input[type="range"]::-moz-range-thumb {@media (max-width: 1100px) {.right-bestiary {grid-template-rows: none;- grid-template-areas: "gallery gallery" "wf wf" "calls cparams" "airway airway" "keys keys";+ grid-template-areas: "act act" "gallery gallery" "wf wf" "cparams cparams" "airway airway" "keys keys";}.right-bestiary .screen-body {min-height: 190px;@@ -2715,7 +2609,7 @@ input[type="range"]::-moz-range-thumb {@media (max-width: 640px) {.right-bestiary {grid-template-columns: minmax(0, 1fr);- grid-template-areas: "gallery" "wf" "calls" "cparams" "airway" "keys";+ grid-template-areas: "act" "gallery" "wf" "cparams" "airway" "keys";}.s-gallery .specimens {grid-template-columns: repeat(2, minmax(0, 1fr));diff --git a/tools/e2e.ts b/tools/e2e.tsindex 4d6a7c4..c6effca 100644--- a/tools/e2e.ts+++ b/tools/e2e.ts@@ -29,7 +29,8 @@ async function run(viewport: { width: number; height: number }, tag: string) {await page.screenshot({ path: `${outDir}/${tag}-0-idle.png` });// the app opens on Sing; this run starts in Playawait page.getByRole("radio", { name: "Play" }).click();- const startBtn = page.getByRole("button", { name: /breathe in and start/i });+ // each tab's main button starts the audio: Play's breathes+ const startBtn = page.getByRole("button", { name: /^Breathe$/ });await startBtn.click();await page.waitForTimeout(1800);await page.screenshot({ path: `${outDir}/${tag}-1-running.png` });@@ -130,12 +131,13 @@ async function run(viewport: { width: number; height: number }, tag: string) {if (!(singing > 0.01)) errors.push(`[${tag}] a sung key made no sound (${singing})`);if (!(after < 1e-3)) errors.push(`[${tag}] voice still sounding after the sung notes: ${after}`);if (sylBefore === sylAfter) errors.push(`[${tag}] the syllable cursor did not move (${sylBefore})`);- await page.getByRole("button", { name: "Made of air" }).click();+ await page.getByRole("combobox", { name: "Song" }).selectOption("Made of air");+ await page.getByRole("button", { name: /^Sing$/ }).click();await page.waitForTimeout(2200);const demoRms = await rms();const demoNow = await page.locator(".syl.now").textContent().catch(() => null);await page.screenshot({ path: `${outDir}/${tag}-5-sing.png`, fullPage: tag !== "desktop" });- await page.getByRole("button", { name: /^Stop “Made of air”$/ }).click();+ await page.getByRole("button", { name: /^Stop$/ }).click();await page.waitForTimeout(700);const demoStopped = await rms();logs.push(`[${tag}] sing demo: rms ${demoRms.toFixed(4)} on "${demoNow}", after stop ${demoStopped.toFixed(4)}`);@@ -148,7 +150,7 @@ async function run(viewport: { width: number; height: number }, tag: string) {for (const [i, name] of names.entries()) {await page.locator(".specimen").nth(i).click();await page.waitForTimeout(250);- await page.locator(".call").first().click();+ await page.locator(".act-call").first().click();await page.waitForTimeout(1300);const slug = name.toLowerCase().replace(/[^a-z]+/g, "-");if (tag === "desktop" || i === 0) await page.screenshot({ path: `${outDir}/${tag}-5-${slug}.png`, fullPage: tag !== "desktop" });@@ -172,8 +174,8 @@ async function run(viewport: { width: number; height: number }, tag: string) {// beatbox: preset, play, playhead + level from telemetry, a pad, stopawait page.getByRole("radio", { name: "Beatbox" }).click();await page.waitForTimeout(300);- await page.getByRole("button", { name: "Breakbeat" }).click();- await page.getByRole("button", { name: "Play beat" }).click();+ await page.getByRole("combobox", { name: "Pattern" }).selectOption("Breakbeat");+ await page.getByRole("button", { name: /^Play beat$/ }).click();const beatSamples: { step: number; rms: number }[] = [];for (let i = 0; i < 8; i++) {await page.waitForTimeout(250);@@ -189,8 +191,18 @@ async function run(viewport: { width: number; height: number }, tag: string) {logs.push(`[${tag}] beatbox steps ${beatSamples.map((b) => b.step).join(",")} rms ${beatSamples.map((b) => b.rms.toFixed(3)).join(",")}`);await page.locator(".pad").first().dispatchEvent("pointerdown");await page.waitForTimeout(300);- await page.getByRole("button", { name: "Stop" }).click();+ await page.getByRole("button", { name: /^Stop$/ }).click();await page.waitForTimeout(300);+ // Space presses the tab's main button (here: the beat on, then off), unless typing+ await page.locator("body").click({ position: { x: 2, y: 2 } });+ await page.keyboard.press("Space");+ await page.waitForTimeout(700);+ const spaceOn = await page.getByRole("button", { name: /^Stop$/ }).count();+ await page.keyboard.press("Space");+ await page.waitForTimeout(300);+ const spaceOff = await page.getByRole("button", { name: /^Play beat$/ }).count();+ logs.push(`[${tag}] beatbox space: playing ${spaceOn}, stopped ${spaceOff}`);+ if (spaceOn !== 1 || spaceOff !== 1) errors.push(`[${tag}] Space didn't start and stop the beat (${spaceOn}, ${spaceOff})`);// back to the human voiceawait page.getByRole("radio", { name: "Play" }).click();await page.waitForTimeout(600);@@ -236,7 +248,7 @@ async function run(viewport: { width: number; height: number }, tag: string) {});await page.goto(url, { waitUntil: "networkidle" });await page.getByRole("radio", { name: "Play" }).click();- await page.getByRole("button", { name: /breathe in and start/i }).click();+ await page.getByRole("button", { name: /^Breathe$/ }).click();await page.waitForTimeout(1500);const rate = await page.evaluate(() => {// @ts-expect-error debug handle@@ -251,6 +263,6 @@ await run({ width: 1440, height: 980 }, "desktop");await run({ width: 390, height: 844 }, "mobile");await browser.close();console.log("console errors:", errors.length ? "\n" + errors.join("\n") : "none");-console.log(logs.filter((l) => /load|rate|warn|transcription|creature|held|back to|beatbox|silence|sing|octave/i.test(l)).slice(0, 40).join("\n"));+console.log(logs.filter((l) => /load|rate|warn|transcription|creature|held|back to|beatbox|silence|sing|octave/i.test(l)).slice(0, 48).join("\n"));// a run that collected errors fails, so CI and agents can't read it as a passif (errors.length) process.exit(1);diff --git a/tools/layout-lint.ts b/tools/layout-lint.tsindex 66b19cd..2d6d821 100644--- a/tools/layout-lint.ts+++ b/tools/layout-lint.ts@@ -16,7 +16,7 @@** Opt-outs, for things meant to sit on top of other things:* - data-layout="overlay" on an element: it and its contents are exempt from overlap checks- * (the start prompt and the beat letter float over the face on purpose)+ * (the beat letter floats over the face on purpose)* - data-layout="layered" on an element: its contents may overlap each other, but not anything* outside it (piano keys: the black keys sit on the white ones)* - data-layout="scatter" on a canvas: its text may overlap other text on the same canvas@@ -330,8 +330,11 @@ async function main() {await mode(m);await check(m);}- await page.locator(".topbar button.primary").click();+ // each tab's main button starts the audio: Play's breathes (then stop breathing)+ await mode("play");+ await page.getByRole("button", { name: /^Breathe$/ }).click();await page.waitForSelector(".load", { timeout: 15000 });+ await page.getByRole("button", { name: /^Stop$/ }).click();for (const m of modes) {await mode(m);await check(`${m} (running)`);