diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 379ecda..1150e39 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -10,7 +10,7 @@ { "name": "devscope", "description": "Real-time developer activity monitoring for Claude Code sessions", - "version": "0.29.0", + "version": "0.30.0", "author": { "name": "Lucas Dow", "email": "lucdow7@gmail.com" diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index fc7e2a9..bc7ff6b 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "devscope", - "version": "0.29.0", + "version": "0.30.0", "description": "Real-time developer activity monitoring for Claude Code sessions", "author": { "name": "Lucas Dow", diff --git a/CHANGELOG.md b/CHANGELOG.md index a2b6955..8c43eaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## [0.30.0] - 2026-10-07 + +### Added +- **`playback_volume` in `voice.json`** (0.5-3, default 1) sets how loud this + computer plays DevScope's speech, so it can be louder without turning up + every other sound. It is passed to `pw-play`, `paplay` and `afplay`; `aplay` + plays as received. `volume` still sets how loud the server makes the speech. + ## [0.29.0] - 2026-10-07 ### Added diff --git a/README.md b/README.md index 1d2356c..4434973 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,7 @@ Running several sessions, or working in another window? `/devscope:voice on` mak - **Across all sessions.** Announcements play one at a time, and three or more at once become one sentence ("three sessions need you: ..."). - **Summaries follow your privacy mode.** Sentences are written by DevScope's AI from what your privacy mode already sends. `private` sessions never leave your machine and use a local template. - **Natural voice, nothing to install.** Speech is voiced by your DevScope server. Which voices it offers is up to the server; the homelab offers **Chatterbox Turbo** (the default, on its GPU) and **Kokoro** (on its CPU, also the fallback when the GPU is busy). `/devscope:voice model` lists them, `/devscope:voice model kokoro` picks one for you, `model default` goes back to the server's choice. -- **Local mode, for Macs.** `/devscope:voice model local` speaks with this computer's own voice instead (`say` on macOS), with no audio from the server. It uses your System voice, so to hear a Siri voice pick one in System Settings → Accessibility → Spoken Content → System voice. The DevScope server still writes the auto voice summaries; only the voice is local. `model chatterbox` (or another server voice) switches back. Speed with `/devscope:voice speed`, volume with `volume` in `voice.json`. `private` sessions, and any time the server can't be reached, use a local voice instead: [Piper](https://github.com/rhasspy/piper) if you ran `/devscope:voice setup` (Linux; `pipx install piper-tts` on macOS), otherwise the system voice (`say`, `spd-say`, `espeak`). +- **Local mode, for Macs.** `/devscope:voice model local` speaks with this computer's own voice instead (`say` on macOS), with no audio from the server. It uses your System voice, so to hear a Siri voice pick one in System Settings → Accessibility → Spoken Content → System voice. The DevScope server still writes the auto voice summaries; only the voice is local. `model chatterbox` (or another server voice) switches back. Speed with `/devscope:voice speed`, volume with `volume` in `voice.json` (how loud the server makes the speech) and `playback_volume` (how loud this computer plays it, without turning up its other sounds). `private` sessions, and any time the server can't be reached, use a local voice instead: [Piper](https://github.com/rhasspy/piper) if you ran `/devscope:voice setup` (Linux; `pipx install piper-tts` on macOS), otherwise the system voice (`say`, `spd-say`, `espeak`). Other commands: `off`, `mute 1h`, `unmute`, `test`, `status`, `finished on` (also announce finished turns after 2 min), `speed slow|normal|fast` (1.0×, 1.2× or 1.5×, for every voice; or any number from 0.5 to 2, e.g. `speed 1.35`), `stop` (end speech in progress). Settings live in `~/.config/devscope/voice.json`. diff --git a/commands/voice.md b/commands/voice.md index ce03225..c7eb403 100644 --- a/commands/voice.md +++ b/commands/voice.md @@ -25,7 +25,7 @@ Three features: - **Announcer** (`on`/`off`): speaks only after a session has waited on the user past a grace delay (30 s for permission prompts and questions, 10 s for failures, 2 min for finished turns if `finished on`), then reminds every 5 min, up to 3 times. Answering in time keeps it silent. - **Auto voice**, per session: `auto` / `auto on` / `auto off` sets it for **this session only** (plain `auto` toggles; `replies` is an old name for it), lasting as long as this Claude Code window. `auto-default on|off` is the setting for sessions where `auto` was not used. Whenever Claude finishes a reply, a two-to-three sentence spoken summary of what it said. The reply is sent to the DevScope server to summarize and is not stored; in `private` mode only " is done" is spoken, locally. A turn that used `explain` is not summarized on top. -`speed slow|normal|fast` sets how fast every voice talks: 1.0x, 1.2x (default) or 1.5x; `speed ` sets any rate from 0.5 to 2 (e.g. `speed 1.35`); plain `speed` shows the current one. `stop` ends speech in progress (a long explanation or a summary). `when-locked quiet|play`: by default (`quiet`) nothing is spoken while the screen is locked (macOS `ioreg`/screensaver, Linux logind `LockedHint`): announcements wait until unlock, auto voice is skipped, an explanation stops; `play` ignores the lock. `verbosity [explain|auto] short|normal|long` sets how detailed explain and auto voice are (both when no mode is named); plain `verbosity` shows them. `auto off` turns off only auto voice; announcements and `explain` are unaffected. `mute` silences auto voice and announcements. Settings live in `~/.config/devscope/voice.json` (`delays`, `reminder_interval`, `max_reminders`, `speak_replies`, `speed` (a number, 0.5-2), `engine`: `auto`/`server`/`piper`/`system`/`off`, `voice`, `volume` (0.5-3, server default 2), `piper_model`). +`speed slow|normal|fast` sets how fast every voice talks: 1.0x, 1.2x (default) or 1.5x; `speed ` sets any rate from 0.5 to 2 (e.g. `speed 1.35`); plain `speed` shows the current one. `stop` ends speech in progress (a long explanation or a summary). `when-locked quiet|play`: by default (`quiet`) nothing is spoken while the screen is locked (macOS `ioreg`/screensaver, Linux logind `LockedHint`): announcements wait until unlock, auto voice is skipped, an explanation stops; `play` ignores the lock. `verbosity [explain|auto] short|normal|long` sets how detailed explain and auto voice are (both when no mode is named); plain `verbosity` shows them. `auto off` turns off only auto voice; announcements and `explain` are unaffected. `mute` silences auto voice and announcements. Settings live in `~/.config/devscope/voice.json` (`delays`, `reminder_interval`, `max_reminders`, `speak_replies`, `speed` (a number, 0.5-2), `engine`: `auto`/`server`/`piper`/`system`/`off`, `voice`, `volume` (0.5-3, server default 2), `playback_volume` (0.5-3, default 1: how loud this computer plays the speech, without turning up its other sounds), `piper_model`). ## Explain mode (`explain [topic]`) diff --git a/scripts/voice/lib.sh b/scripts/voice/lib.sh index 5f901f6..9a96791 100755 --- a/scripts/voice/lib.sh +++ b/scripts/voice/lib.sh @@ -106,6 +106,12 @@ _ds_voice_int() { printf '%s' "$v" } +# A number from voice.json: its default when unset or not a number, kept within min..max. +_ds_voice_num() { # key default min max + _ds_voice_conf "$1" "$2" | awk -v d="$2" -v lo="$3" -v hi="$4" ' + { v = $0 + 0; if ($0 !~ /^[0-9]*\.?[0-9]+$/) v = d; if (v < lo) v = lo; if (v > hi) v = hi; print v }' +} + _ds_voice_enabled() { [ -f "$DS_VOICE_CONFIG" ] && [ "$(_ds_voice_conf .enabled false)" = "true" ] } @@ -207,10 +213,11 @@ _ds_voice_speed_preset() { } # The speech rate, clamped to what the server voice accepts (0.5-2). -_ds_voice_speed() { - _ds_voice_conf .speed "$DS_VOICE_SPEED_NORMAL" | awk -v d="$DS_VOICE_SPEED_NORMAL" ' - { v = $0 + 0; if ($0 !~ /^[0-9]*\.?[0-9]+$/) v = d; if (v < 0.5) v = 0.5; if (v > 2) v = 2; print v }' -} +_ds_voice_speed() { _ds_voice_num .speed "$DS_VOICE_SPEED_NORMAL" 0.5 2; } + +# How loud this computer plays DevScope's speech (voice.json `playback_volume`, +# 1 = as received, up to 3): louder speech without turning up every other sound. +_ds_voice_playback_volume() { _ds_voice_num .playback_volume 1 0.5 3; } # The preset a rate matches, or "custom". _ds_voice_speed_name() { @@ -707,13 +714,19 @@ _ds_voice_run() { fi } -_ds_voice_play() { - local p +# Plays at the playback volume; aplay has no volume option. +_ds_voice_play() { # wav + local p vol + vol=$(_ds_voice_playback_volume) for p in paplay pw-play aplay afplay; do - if command -v "$p" >/dev/null 2>&1; then - _ds_voice_run "$p" "$1" >/dev/null 2>&1 - return - fi + command -v "$p" >/dev/null 2>&1 || continue + case "$p" in + paplay) _ds_voice_run paplay --volume="$(awk -v v="$vol" 'BEGIN { printf "%d", v * 65536 }')" "$1" ;; + pw-play) _ds_voice_run pw-play --volume "$vol" "$1" ;; + afplay) _ds_voice_run afplay -v "$vol" "$1" ;; + *) _ds_voice_run "$p" "$1" ;; + esac >/dev/null 2>&1 + return done return 1 } diff --git a/tests/voice/run.sh b/tests/voice/run.sh index 7f6755a..33a7320 100644 --- a/tests/voice/run.sh +++ b/tests/voice/run.sh @@ -177,6 +177,27 @@ configure '.model = "kokoro"'; server_speak standard >/dev/null configure; respond "RIFFfake" "audio/wav" configure '.voice = "af_heart" | .speed = 1.2 | .volume = 2.5' server_speak standard >/dev/null; [ "$(last .body.voice)/$(last .body.speed)/$(last .body.volume)" = "af_heart/1.2/2.5" ] && ok "server voice: voice, speed and volume from voice.json" || bad "server config" "$(last .body)" +# Local playback volume: passed to the player, so only DevScope's speech gets louder. +play_with() { # player -> the arguments it was called with + local bin="$TMP/playbin-$1" t + rm -rf "$bin"; mkdir -p "$bin" + for t in awk jq timeout perl; do command -v "$t" >/dev/null && ln -s "$(command -v "$t")" "$bin/$t"; done + printf '#!/bin/sh\necho "$*" > "%s"\n' "$TMP/play-args" > "$bin/$1"; chmod +x "$bin/$1" + rm -f "$TMP/play-args" + ( PATH="$bin"; . "$S/_helpers.sh"; . "$S/voice/lib.sh"; _ds_voice_play /x.wav ) + cat "$TMP/play-args" 2>/dev/null +} +configure +[ "$(play_with pw-play)" = "--volume 1 /x.wav" ] && ok "playback volume: 1 by default" || bad "playback default" "$(play_with pw-play)" +configure '.playback_volume = 1.5' +[ "$(play_with pw-play)" = "--volume 1.5 /x.wav" ] && ok "playback volume: pw-play gets it" || bad "playback pw-play" "$(play_with pw-play)" +[ "$(play_with paplay)" = "--volume=98304 /x.wav" ] && ok "playback volume: paplay gets it in its units" || bad "playback paplay" "$(play_with paplay)" +[ "$(play_with afplay)" = "-v 1.5 /x.wav" ] && ok "playback volume: afplay gets it" || bad "playback afplay" "$(play_with afplay)" +[ "$(play_with aplay)" = "/x.wav" ] && ok "playback volume: aplay plays as received" || bad "playback aplay" "$(play_with aplay)" +configure '.playback_volume = 9' +[ "$(play_with pw-play)" = "--volume 3 /x.wav" ] && ok "playback volume: clamped to 3" || bad "playback clamp" "$(play_with pw-play)" +configure '.playback_volume = "loud"' +[ "$(play_with pw-play)" = "--volume 1 /x.wav" ] && ok "playback volume: not a number means 1" || bad "playback bad" "$(play_with pw-play)" configure; reset_hits [ "$(server_speak private)" = "1 " ] && [ "$(hits)" = 0 ] && ok "server voice: never for private sessions" || bad "server private" "hits=$(hits)" respond '{"error":"Server voice unavailable"}' "application/json" 503