claude voice mode

This commit is contained in:
David Chen 2025-08-28 12:31:51 -07:00
parent f47f02166e
commit 587f956396
6 changed files with 80 additions and 1 deletions

View file

@ -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)

View file

@ -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
```

View file

@ -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
```

11
claude/scripts/voice-off.sh Executable file
View file

@ -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"

11
claude/scripts/voice-on.sh Executable file
View file

@ -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"

View file

@ -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"
}
]
}
]
}
}
}