diff --git a/README.md b/README.md index 08ca07e..3fc446b 100644 --- a/README.md +++ b/README.md @@ -88,5 +88,29 @@ yay -S wqy-bitmapfont wqy-microhei wqy-microhei-lite wqy-zenhei adobe-source-han ## gtk-theme I use `adapta-gtk-theme` and `arc-icon-theme`. +## Claude Code Voice Configuration + +This config includes a directory-based voice system for Claude Code that uses macOS text-to-speech. + +### Voice Commands +- `/voice-on` - Enable text-to-speech for current directory +- `/voice-off` - Disable text-to-speech for current directory + +### Selecting and Downloading High Quality System Voices + +For the best text-to-speech experience, download high-quality system voices: + +1. **Open System Preferences** → **Accessibility** → **Spoken Content** +2. **Click "System Voice"** dropdown → **Customize...** +3. **Download premium voices** (these are much higher quality than default): + - **English**: Alex (Enhanced), Samantha (Enhanced), Victoria (Enhanced) + - **Other languages**: Download enhanced versions as needed +4. **Select your preferred voice** in the System Voice dropdown + +**Note**: Enhanced voices are 100-200MB each but provide significantly better speech quality than compact voices. + +### Voice Database +Voice settings are stored per-directory in `~/.claude/voice-db.json` and automatically created by the scripts. + ## Arch Packages I Installed: See [my-packages.txt](https://github.com/theniceboy/.config/blob/master/my-packages.txt) diff --git a/claude/commands/voice-off.md b/claude/commands/voice-off.md new file mode 100644 index 0000000..11fc8e3 --- /dev/null +++ b/claude/commands/voice-off.md @@ -0,0 +1,10 @@ +--- +description: "Disable text-to-speech for Claude responses" +allowed_tools: ["Edit"] +--- + +Disable text-to-speech for Claude responses in the current directory. + +```bash +bash ~/.claude/scripts/voice-off.sh +``` \ No newline at end of file diff --git a/claude/commands/voice-on.md b/claude/commands/voice-on.md new file mode 100644 index 0000000..1d8985b --- /dev/null +++ b/claude/commands/voice-on.md @@ -0,0 +1,10 @@ +--- +description: "Enable text-to-speech for Claude responses" +allowed_tools: ["Edit"] +--- + +Enable text-to-speech for Claude responses in the current directory. + +```bash +bash ~/.claude/scripts/voice-on.sh +``` \ No newline at end of file diff --git a/claude/scripts/voice-off.sh b/claude/scripts/voice-off.sh new file mode 100755 index 0000000..a4dff19 --- /dev/null +++ b/claude/scripts/voice-off.sh @@ -0,0 +1,11 @@ +#!/bin/bash +current_dir=$(pwd) +voice_db="$HOME/.claude/voice-db.json" + +# Create voice database if it doesn't exist +if [ ! -f "$voice_db" ]; then + echo "{}" > "$voice_db" +fi + +jq --arg dir "$current_dir" '.[$dir] = false' "$voice_db" > /tmp/voice-db-temp.json && mv /tmp/voice-db-temp.json "$voice_db" +echo "Voice disabled for $current_dir" \ No newline at end of file diff --git a/claude/scripts/voice-on.sh b/claude/scripts/voice-on.sh new file mode 100755 index 0000000..2f4f82f --- /dev/null +++ b/claude/scripts/voice-on.sh @@ -0,0 +1,11 @@ +#!/bin/bash +current_dir=$(pwd) +voice_db="$HOME/.claude/voice-db.json" + +# Create voice database if it doesn't exist +if [ ! -f "$voice_db" ]; then + echo "{}" > "$voice_db" +fi + +jq --arg dir "$current_dir" '.[$dir] = true' "$voice_db" > /tmp/voice-db-temp.json && mv /tmp/voice-db-temp.json "$voice_db" +echo "Voice enabled for $current_dir" \ No newline at end of file diff --git a/claude/settings.json b/claude/settings.json index 0ee9390..6df971b 100644 --- a/claude/settings.json +++ b/claude/settings.json @@ -4,5 +4,18 @@ "type": "command", "command": "bash ~/.config/claude/scripts/statusline.sh", "padding": 0 + }, + "hooks": { + "Stop": [ + { + "matcher": ".*", + "hooks": [ + { + "type": "command", + "command": "current_dir=$(pwd); voice_db=\"$HOME/.claude/voice-db.json\"; if [ -f \"$voice_db\" ] && [ \"$(jq -r --arg dir \"$current_dir\" '.[$dir] // false' \"$voice_db\")\" = \"true\" ]; then transcript_path=$(cat | jq -r '.transcript_path'); tail -1 \"$transcript_path\" | jq -r '.message.content[0].text // empty' | say & fi" + } + ] + } + ] } -} \ No newline at end of file +}