Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(appshot): make the capture cue a crisp click-clack
rubenluetke10-beepdb40d42224d1
diff --git a/jarvis/audio/chime.py b/jarvis/audio/chime.pyindex e41ac958dd..91b3d15479 100644--- a/jarvis/audio/chime.py+++ b/jarvis/audio/chime.py@@ -93,58 +93,39 @@ SCREEN_CAPTURE_PREROLL_S: float = 0.045def generate_screen_capture_pcm(sample_rate: int = 24_000,- amplitude: float = 0.2,+ amplitude: float = 0.22,) -> bytes:- """Generate the appshot cue: a soft, rounded two-note "bloop".+ """Generate the appshot cue: a crisp, tactile "click-clack".- A sine that glides up a fourth (D5 -> G5) lands on a gentle D6 bell, both- with a smooth attack and a short synthetic room tail. Every onset sits- after ``SCREEN_CAPTURE_PREROLL_S`` of silence, so a freshly opened stream- plays the whole cue (the former noise-burst shutter packed half its- energy into the first 5 ms and was inaudible). Synthesized in memory:- portable and free of third-party recordings.+ Two short clicks, like a phone camera shutter. Each one is a damped high+ tick (a few kHz) over a whisper of band-limited noise, with a 1 ms attack+ so it snaps without a digital edge; the second is a touch lower and+ softer. Every onset sits after ``SCREEN_CAPTURE_PREROLL_S`` of silence,+ because a freshly opened stream fades and swallows its first milliseconds.+ Synthesized in memory: portable and free of third-party recordings.The peak stays low on purpose: the player's master volume adds up to 4x- makeup gain, and a louder source would ride the peak limiter instead of- staying soft.+ makeup gain, and a louder source would ride the peak limiter."""preroll = int(SCREEN_CAPTURE_PREROLL_S * sample_rate)- body_s = 0.34+ body_s = 0.12n = int(body_s * sample_rate)t = np.arange(n, dtype=np.float64) / float(sample_rate)+ rng = np.random.default_rng(0x5C4E_454E)+ # Differentiated noise tilts the spectrum up: an airy tick, not a hiss.+ noise = np.diff(rng.uniform(-1.0, 1.0, n + 1))- def _note(- onset: float,- f_start: float,- f_end: float,- glide_s: float,- attack_s: float,- decay: float,- ) -> np.ndarray:+ def _click(onset: float, pitch: float, strength: float) -> np.ndarray:local_t = np.maximum(t - onset, 0.0)active = t >= onset- # Smoothstep glide, integrated into phase so the pitch bend has no seam.- g = np.clip(local_t / glide_s, 0.0, 1.0) if glide_s > 0 else np.ones_like(t)- freq = f_start + (f_end - f_start) * (g * g * (3.0 - 2.0 * g))- phase = 2.0 * np.pi * np.cumsum(freq * active) / sample_rate- tone = np.sin(phase) + 0.12 * np.sin(2.0 * phase) # a touch of warmth- attack = 0.5 - 0.5 * np.cos(np.pi * np.clip(local_t / attack_s, 0.0, 1.0))- return tone * attack * np.exp(-local_t * decay) * active-- dry = _note(0.0, 587.33, 783.99, 0.05, 0.008, 20.0)- dry += 0.8 * _note(0.075, 1174.66, 1174.66, 0.0, 0.010, 13.0)-- # A few soft, darkened early reflections give the cue air without a- # convolution dependency.- wave = dry.copy()- for delay_s, gain in ((0.031, 0.22), (0.053, 0.15), (0.083, 0.09)):- shift = int(delay_s * sample_rate)- echo = np.zeros_like(dry)- echo[shift:] = dry[:-shift]- echo = np.convolve(echo, np.ones(6) / 6.0, mode="same")- wave += gain * echo-- fade_out = np.clip((body_s - t) / 0.04, 0.0, 1.0)+ attack = np.clip(local_t / 0.001, 0.0, 1.0)+ tick = np.sin(2.0 * np.pi * pitch * local_t) * np.exp(-local_t * 260.0)+ body = np.sin(2.0 * np.pi * pitch * 0.5 * local_t) * np.exp(-local_t * 140.0)+ air = noise * np.exp(-local_t * 420.0)+ return strength * attack * (0.55 * tick + 0.25 * body + 0.35 * air) * active++ wave = _click(0.0, 3400.0, 1.0) + _click(0.048, 2600.0, 0.7)+ fade_out = np.clip((body_s - t) / 0.01, 0.0, 1.0)wave *= fade_outwave *= amplitude / max(float(np.max(np.abs(wave))), 1e-9)wave = np.concatenate([np.zeros(preroll), wave])diff --git a/tests/unit/audio/test_chime_ready.py b/tests/unit/audio/test_chime_ready.pyindex dced9153f4..9800428211 100644--- a/tests/unit/audio/test_chime_ready.py+++ b/tests/unit/audio/test_chime_ready.py@@ -47,15 +47,13 @@ def test_screen_capture_cue_is_original_and_deterministic() -> None:def test_screen_capture_cue_survives_a_fresh_stream_onset() -> None:- """The cue must not live in its first milliseconds.+ """The cue must start after a silent pre-roll.``play_pcm`` fades the first 5 ms and a freshly opened device swallows its- start; the old shutter packed ~half its energy there and was inaudible.+ start; a click that begins at sample 0 loses its whole transient there."""samples = np.frombuffer(SCREEN_CAPTURE_PCM, dtype=np.int16).astype(np.float64)preroll = int(SCREEN_CAPTURE_PREROLL_S * CHIME_SAMPLE_RATE)assert not samples[:preroll].any()- energy = np.cumsum(samples**2)- early = energy[preroll + int(0.005 * CHIME_SAMPLE_RATE)] / energy[-1]- assert early < 0.05+ assert np.abs(samples[preroll:]).max() > 0assert np.max(np.abs(samples)) < 32767 * 0.5 # soft, never clipping