agentvibes 2.0.17 → 2.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/activation-instructions +54 -0
- package/.claude/github-star-reminder.txt +1 -1
- package/.claude/hooks/bmad-tts-injector.sh +33 -4
- package/.claude/hooks/bmad-voice-manager.sh +146 -10
- package/.claude/hooks/check-output-style.sh +60 -8
- package/.claude/hooks/github-star-reminder.sh +67 -7
- package/.claude/hooks/language-manager.sh +34 -2
- package/.claude/hooks/learn-manager.sh +34 -2
- package/.claude/hooks/personality-manager.sh +34 -1
- package/.claude/hooks/piper-download-voices.sh +131 -9
- package/.claude/hooks/piper-installer.sh +38 -4
- package/.claude/hooks/piper-voice-manager.sh +102 -36
- package/.claude/hooks/play-tts-elevenlabs.sh +32 -6
- package/.claude/hooks/play-tts-piper.sh +79 -18
- package/.claude/hooks/play-tts.sh +34 -3
- package/.claude/hooks/provider-commands.sh +36 -1
- package/.claude/hooks/provider-manager.sh +32 -1
- package/.claude/hooks/replay-target-audio.sh +34 -3
- package/.claude/hooks/sentiment-manager.sh +39 -1
- package/.claude/hooks/speed-manager.sh +36 -2
- package/.claude/hooks/voice-manager.sh +85 -6
- package/.claude/hooks/voices-config.sh +39 -2
- package/README.md +77 -137
- package/RELEASE_NOTES.md +269 -0
- package/RELEASE_NOTES_v2.0.17_DRAFT.md +650 -0
- package/docs/ai-optimized-documentation-standards.md +78 -4
- package/docs/bryce-beattie-voice-licensing.md +131 -0
- package/docs/commands.md +21 -1
- package/docs/mcp-setup.md +1 -6
- package/github-star-reminder.txt +1 -0
- package/mcp-server/WINDOWS_SETUP.md +182 -199
- package/mcp-server/docs/elevenlabs-setup.md +213 -0
- package/mcp-server/docs/troubleshooting-audio.md +316 -0
- package/mcp-server/server.py +38 -4
- package/mcp-server/test_server.py +38 -3
- package/package.json +1 -1
- package/test/helpers/test-helper.bash +31 -4
- package/test/unit/personality-manager.bats +22 -6
- package/test/unit/play-tts.bats +21 -3
- package/test/unit/provider-manager.bats +508 -0
- package/test/unit/speed-manager.bats +436 -0
- package/test/unit/voice-manager.bats +4 -1
|
@@ -1,11 +1,43 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
3
|
+
# File: .claude/hooks/piper-download-voices.sh
|
|
4
|
+
#
|
|
5
|
+
# AgentVibes - Finally, your AI Agents can Talk Back! Text-to-Speech WITH personality for AI Assistants!
|
|
6
|
+
# Website: https://agentvibes.org
|
|
7
|
+
# Repository: https://github.com/paulpreibisch/AgentVibes
|
|
8
|
+
#
|
|
9
|
+
# Co-created by Paul Preibisch with Claude AI
|
|
10
|
+
# Copyright (c) 2025 Paul Preibisch
|
|
11
|
+
#
|
|
12
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
# you may not use this file except in compliance with the License.
|
|
14
|
+
# You may obtain a copy of the License at
|
|
15
|
+
#
|
|
16
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
#
|
|
18
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
# See the License for the specific language governing permissions and
|
|
22
|
+
# limitations under the License.
|
|
23
|
+
#
|
|
24
|
+
# DISCLAIMER: This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
# express or implied, including but not limited to the warranties of
|
|
26
|
+
# merchantability, fitness for a particular purpose and noninfringement.
|
|
27
|
+
# In no event shall the authors or copyright holders be liable for any claim,
|
|
28
|
+
# damages or other liability, whether in an action of contract, tort or
|
|
29
|
+
# otherwise, arising from, out of or in connection with the software or the
|
|
30
|
+
# use or other dealings in the software.
|
|
31
|
+
#
|
|
32
|
+
# ---
|
|
33
|
+
#
|
|
34
|
+
# @fileoverview Piper Voice Model Downloader - Batch downloads popular Piper TTS voices from HuggingFace
|
|
35
|
+
# @context Post-installation utility to download commonly used voices (~25MB each)
|
|
36
|
+
# @architecture Wrapper around piper-voice-manager.sh download functions with progress tracking
|
|
37
|
+
# @dependencies piper-voice-manager.sh (download logic), piper binary (for validation)
|
|
38
|
+
# @entrypoints Called by piper-installer.sh or manually via ./piper-download-voices.sh [--yes|-y]
|
|
39
|
+
# @patterns Batch operations, skip-existing logic, auto-yes flag for non-interactive use
|
|
40
|
+
# @related piper-voice-manager.sh, piper-installer.sh
|
|
9
41
|
#
|
|
10
42
|
|
|
11
43
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
@@ -17,7 +49,7 @@ if [[ "$1" == "--yes" ]] || [[ "$1" == "-y" ]]; then
|
|
|
17
49
|
AUTO_YES=true
|
|
18
50
|
fi
|
|
19
51
|
|
|
20
|
-
# Common voice models to download
|
|
52
|
+
# Common voice models to download from HuggingFace (official Piper voices)
|
|
21
53
|
COMMON_VOICES=(
|
|
22
54
|
"en_US-lessac-medium" # Default, clear male
|
|
23
55
|
"en_US-amy-medium" # Warm female
|
|
@@ -26,6 +58,16 @@ COMMON_VOICES=(
|
|
|
26
58
|
"en_US-libritts-high" # Premium quality
|
|
27
59
|
)
|
|
28
60
|
|
|
61
|
+
# Custom high-quality voices from AgentVibes HuggingFace repository
|
|
62
|
+
# Original voices by Bryce Beattie (https://brycebeattie.com/files/tts/)
|
|
63
|
+
# Repository: https://huggingface.co/agentvibes/piper-custom-voices
|
|
64
|
+
# Licensed: Public Domain (Kristin, 16Speakers) / CC BY attribution (Jenny)
|
|
65
|
+
CUSTOM_VOICES=(
|
|
66
|
+
"kristin:https://huggingface.co/agentvibes/piper-custom-voices/resolve/main/kristin.onnx:https://huggingface.co/agentvibes/piper-custom-voices/resolve/main/kristin.onnx.json" # US English female (Public Domain)
|
|
67
|
+
"jenny:https://huggingface.co/agentvibes/piper-custom-voices/resolve/main/jenny.onnx:https://huggingface.co/agentvibes/piper-custom-voices/resolve/main/jenny.onnx.json" # UK English female, Irish (CC BY attribution required)
|
|
68
|
+
"16Speakers:https://huggingface.co/agentvibes/piper-custom-voices/resolve/main/16Speakers.onnx:https://huggingface.co/agentvibes/piper-custom-voices/resolve/main/16Speakers.onnx.json" # Multi-speaker: 16 voices (Public Domain)
|
|
69
|
+
)
|
|
70
|
+
|
|
29
71
|
echo "🎙️ Piper Voice Model Downloader"
|
|
30
72
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
31
73
|
echo ""
|
|
@@ -118,16 +160,96 @@ done
|
|
|
118
160
|
|
|
119
161
|
echo ""
|
|
120
162
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
121
|
-
echo "📊 Download Summary:"
|
|
163
|
+
echo "📊 Download Summary (Standard Voices):"
|
|
122
164
|
echo " ✅ Successfully downloaded: $DOWNLOADED"
|
|
123
165
|
echo " ❌ Failed: $FAILED"
|
|
124
166
|
echo " 📦 Total voices available: $((ALREADY_DOWNLOADED + DOWNLOADED))"
|
|
125
167
|
echo ""
|
|
126
168
|
|
|
127
|
-
|
|
169
|
+
# Now offer to download custom high-quality voices from Bryce Beattie
|
|
170
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
171
|
+
echo "🎨 Custom High-Quality Voices Available"
|
|
172
|
+
echo ""
|
|
173
|
+
echo "Additional premium voices from AgentVibes:"
|
|
174
|
+
echo " • Kristin - US English female (Public Domain)"
|
|
175
|
+
echo " • Jenny - UK English female, Irish accent (CC BY)"
|
|
176
|
+
echo " • 16Speakers - Multi-speaker: 16 different voices (Public Domain)"
|
|
177
|
+
echo ""
|
|
178
|
+
echo "Repository: https://huggingface.co/agentvibes/piper-custom-voices"
|
|
179
|
+
echo "Original voices by: Bryce Beattie (https://brycebeattie.com/files/tts/)"
|
|
180
|
+
echo ""
|
|
181
|
+
|
|
182
|
+
if [[ "$AUTO_YES" == "false" ]]; then
|
|
183
|
+
read -p "Download custom voices (Kristin + Jenny + 16Speakers)? [Y/n]: " -n 1 -r
|
|
184
|
+
echo
|
|
185
|
+
|
|
186
|
+
if [[ $REPLY =~ ^[Yy]$ ]] || [[ -z $REPLY ]]; then
|
|
187
|
+
DOWNLOAD_CUSTOM=true
|
|
188
|
+
else
|
|
189
|
+
DOWNLOAD_CUSTOM=false
|
|
190
|
+
fi
|
|
191
|
+
else
|
|
192
|
+
DOWNLOAD_CUSTOM=true
|
|
193
|
+
fi
|
|
194
|
+
|
|
195
|
+
if [[ "$DOWNLOAD_CUSTOM" == "true" ]]; then
|
|
196
|
+
echo ""
|
|
197
|
+
echo "📥 Downloading custom voices..."
|
|
198
|
+
|
|
199
|
+
CUSTOM_DOWNLOADED=0
|
|
200
|
+
CUSTOM_FAILED=0
|
|
201
|
+
|
|
202
|
+
for voice_entry in "${CUSTOM_VOICES[@]}"; do
|
|
203
|
+
IFS=':' read -r voice_name onnx_url json_url <<< "$voice_entry"
|
|
204
|
+
|
|
205
|
+
echo ""
|
|
206
|
+
echo "📥 Downloading: $voice_name..."
|
|
207
|
+
|
|
208
|
+
# Create filename from voice name
|
|
209
|
+
onnx_file="$VOICE_DIR/${voice_name}.onnx"
|
|
210
|
+
json_file="$VOICE_DIR/${voice_name}.onnx.json"
|
|
211
|
+
|
|
212
|
+
# Download .onnx file
|
|
213
|
+
if curl -L "$onnx_url" -o "$onnx_file" 2>/dev/null; then
|
|
214
|
+
# Download .json config file
|
|
215
|
+
if curl -L "$json_url" -o "$json_file" 2>/dev/null; then
|
|
216
|
+
((CUSTOM_DOWNLOADED++))
|
|
217
|
+
echo "✅ Downloaded: $voice_name"
|
|
218
|
+
else
|
|
219
|
+
((CUSTOM_FAILED++))
|
|
220
|
+
echo "❌ Failed to download config: $voice_name"
|
|
221
|
+
rm -f "$onnx_file" # Clean up partial download
|
|
222
|
+
fi
|
|
223
|
+
else
|
|
224
|
+
((CUSTOM_FAILED++))
|
|
225
|
+
echo "❌ Failed to download model: $voice_name"
|
|
226
|
+
fi
|
|
227
|
+
done
|
|
228
|
+
|
|
229
|
+
echo ""
|
|
230
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
231
|
+
echo "📊 Custom Voices Summary:"
|
|
232
|
+
echo " ✅ Successfully downloaded: $CUSTOM_DOWNLOADED"
|
|
233
|
+
echo " ❌ Failed: $CUSTOM_FAILED"
|
|
234
|
+
echo ""
|
|
235
|
+
fi
|
|
236
|
+
|
|
237
|
+
TOTAL_DOWNLOADED=$((DOWNLOADED + ${CUSTOM_DOWNLOADED:-0}))
|
|
238
|
+
|
|
239
|
+
if [[ $TOTAL_DOWNLOADED -gt 0 ]]; then
|
|
128
240
|
echo "✨ Ready to use Piper TTS with downloaded voices!"
|
|
129
241
|
echo ""
|
|
130
242
|
echo "Try it:"
|
|
131
243
|
echo " /agent-vibes:provider switch piper"
|
|
132
244
|
echo " /agent-vibes:preview"
|
|
245
|
+
echo ""
|
|
246
|
+
echo "Attribution:"
|
|
247
|
+
echo " • Original voices by Bryce Beattie - https://brycebeattie.com/files/tts/"
|
|
248
|
+
echo " • Hosted by AgentVibes - https://huggingface.co/agentvibes/piper-custom-voices"
|
|
249
|
+
echo " • Jenny voice requires attribution (CC BY license)"
|
|
250
|
+
echo ""
|
|
251
|
+
echo "Using 16Speakers multi-voice:"
|
|
252
|
+
echo " • Switch to specific speaker: /agent-vibes:switch 16Speakers#0"
|
|
253
|
+
echo " • Speakers 0-15 available (Cori, Kara, Kristin, Maria, Mike, etc.)"
|
|
254
|
+
echo " • View all speakers: /agent-vibes:list"
|
|
133
255
|
fi
|
|
@@ -1,9 +1,43 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
3
|
+
# File: .claude/hooks/piper-installer.sh
|
|
4
|
+
#
|
|
5
|
+
# AgentVibes - Finally, your AI Agents can Talk Back! Text-to-Speech WITH personality for AI Assistants!
|
|
6
|
+
# Website: https://agentvibes.org
|
|
7
|
+
# Repository: https://github.com/paulpreibisch/AgentVibes
|
|
8
|
+
#
|
|
9
|
+
# Co-created by Paul Preibisch with Claude AI
|
|
10
|
+
# Copyright (c) 2025 Paul Preibisch
|
|
11
|
+
#
|
|
12
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
# you may not use this file except in compliance with the License.
|
|
14
|
+
# You may obtain a copy of the License at
|
|
15
|
+
#
|
|
16
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
#
|
|
18
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
# See the License for the specific language governing permissions and
|
|
22
|
+
# limitations under the License.
|
|
23
|
+
#
|
|
24
|
+
# DISCLAIMER: This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
# express or implied, including but not limited to the warranties of
|
|
26
|
+
# merchantability, fitness for a particular purpose and noninfringement.
|
|
27
|
+
# In no event shall the authors or copyright holders be liable for any claim,
|
|
28
|
+
# damages or other liability, whether in an action of contract, tort or
|
|
29
|
+
# otherwise, arising from, out of or in connection with the software or the
|
|
30
|
+
# use or other dealings in the software.
|
|
31
|
+
#
|
|
32
|
+
# ---
|
|
33
|
+
#
|
|
34
|
+
# @fileoverview Piper TTS Installer - Installs Piper TTS via pipx and downloads initial voice models
|
|
35
|
+
# @context Automated installation script for free offline Piper TTS on WSL/Linux systems
|
|
36
|
+
# @architecture Helper script for AgentVibes installer, invoked manually or from provider switcher
|
|
37
|
+
# @dependencies pipx (Python package installer), apt-get/brew/dnf/pacman (for pipx installation)
|
|
38
|
+
# @entrypoints Called by src/installer.js or manually by users during setup
|
|
39
|
+
# @patterns Platform detection (WSL/Linux only), package manager abstraction, guided voice download
|
|
40
|
+
# @related piper-download-voices.sh, provider-manager.sh, src/installer.js
|
|
7
41
|
#
|
|
8
42
|
|
|
9
43
|
set -e # Exit on error
|
|
@@ -1,23 +1,66 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
3
|
+
# File: .claude/hooks/piper-voice-manager.sh
|
|
4
|
+
#
|
|
5
|
+
# AgentVibes - Finally, your AI Agents can Talk Back! Text-to-Speech WITH personality for AI Assistants!
|
|
6
|
+
# Website: https://agentvibes.org
|
|
7
|
+
# Repository: https://github.com/paulpreibisch/AgentVibes
|
|
8
|
+
#
|
|
9
|
+
# Co-created by Paul Preibisch with Claude AI
|
|
10
|
+
# Copyright (c) 2025 Paul Preibisch
|
|
11
|
+
#
|
|
12
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
# you may not use this file except in compliance with the License.
|
|
14
|
+
# You may obtain a copy of the License at
|
|
15
|
+
#
|
|
16
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
#
|
|
18
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
# See the License for the specific language governing permissions and
|
|
22
|
+
# limitations under the License.
|
|
23
|
+
#
|
|
24
|
+
# DISCLAIMER: This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
# express or implied, including but not limited to the warranties of
|
|
26
|
+
# merchantability, fitness for a particular purpose and noninfringement.
|
|
27
|
+
# In no event shall the authors or copyright holders be liable for any claim,
|
|
28
|
+
# damages or other liability, whether in an action of contract, tort or
|
|
29
|
+
# otherwise, arising from, out of or in connection with the software or the
|
|
30
|
+
# use or other dealings in the software.
|
|
31
|
+
#
|
|
32
|
+
# ---
|
|
33
|
+
#
|
|
34
|
+
# @fileoverview Piper Voice Model Management - Downloads, caches, and validates Piper ONNX voice models
|
|
35
|
+
# @context Voice model lifecycle management for free offline Piper TTS provider
|
|
36
|
+
# @architecture HuggingFace repository integration with local caching, global storage for voice models
|
|
37
|
+
# @dependencies curl (downloads), piper binary (TTS synthesis)
|
|
38
|
+
# @entrypoints Sourced by play-tts-piper.sh, piper-download-voices.sh, and provider management commands
|
|
39
|
+
# @patterns HuggingFace model repository integration, file-based caching (~25MB per voice), global storage
|
|
40
|
+
# @related play-tts-piper.sh, piper-download-voices.sh, provider-manager.sh, GitHub Issue #25
|
|
10
41
|
#
|
|
11
42
|
|
|
12
43
|
# Base URL for Piper voice models on HuggingFace
|
|
13
44
|
PIPER_VOICES_BASE_URL="https://huggingface.co/rhasspy/piper-voices/resolve/main"
|
|
14
45
|
|
|
46
|
+
# AI NOTE: Voice storage precedence order:
|
|
47
|
+
# 1. PIPER_VOICES_DIR environment variable (highest priority)
|
|
48
|
+
# 2. Project-local .claude/piper-voices-dir.txt
|
|
49
|
+
# 3. Directory tree search for .claude/piper-voices-dir.txt
|
|
50
|
+
# 4. Global ~/.claude/piper-voices-dir.txt
|
|
51
|
+
# 5. Default ~/.claude/piper-voices (fallback)
|
|
52
|
+
# This allows per-project voice isolation while defaulting to shared global storage.
|
|
53
|
+
|
|
15
54
|
# @function get_voice_storage_dir
|
|
16
|
-
# @intent Determine directory for storing Piper voice models
|
|
17
|
-
# @why Voice models are large (~25MB each) and should be shared globally
|
|
18
|
-
# @
|
|
55
|
+
# @intent Determine directory for storing Piper voice models with precedence chain
|
|
56
|
+
# @why Voice models are large (~25MB each) and should be shared globally by default, but allow per-project overrides
|
|
57
|
+
# @param None
|
|
58
|
+
# @returns Echoes path to voice storage directory
|
|
59
|
+
# @exitcode Always 0
|
|
19
60
|
# @sideeffects Creates directory if it doesn't exist
|
|
20
|
-
# @
|
|
61
|
+
# @edgecases Searches up directory tree for .claude/ folder, supports custom paths via env var or config files
|
|
62
|
+
# @calledby All voice management functions (verify_voice, get_voice_path, download_voice, list_downloaded_voices)
|
|
63
|
+
# @calls mkdir, cat, dirname
|
|
21
64
|
get_voice_storage_dir() {
|
|
22
65
|
local voice_dir
|
|
23
66
|
|
|
@@ -61,12 +104,15 @@ get_voice_storage_dir() {
|
|
|
61
104
|
}
|
|
62
105
|
|
|
63
106
|
# @function verify_voice
|
|
64
|
-
# @intent Check if voice model files exist locally
|
|
65
|
-
# @why Avoid redundant downloads, detect missing models
|
|
107
|
+
# @intent Check if voice model files exist locally (both .onnx and .onnx.json)
|
|
108
|
+
# @why Avoid redundant downloads, detect missing models, ensure model integrity
|
|
66
109
|
# @param $1 {string} voice_name - Voice model name (e.g., en_US-lessac-medium)
|
|
67
110
|
# @returns None
|
|
68
|
-
# @exitcode 0=voice exists, 1=voice missing
|
|
69
|
-
# @sideeffects None
|
|
111
|
+
# @exitcode 0=voice exists and complete, 1=voice missing or incomplete
|
|
112
|
+
# @sideeffects None (read-only check)
|
|
113
|
+
# @edgecases Requires both ONNX model and JSON config to return success
|
|
114
|
+
# @calledby download_voice, piper-download-voices.sh
|
|
115
|
+
# @calls get_voice_storage_dir
|
|
70
116
|
verify_voice() {
|
|
71
117
|
local voice_name="$1"
|
|
72
118
|
local voice_dir
|
|
@@ -79,12 +125,15 @@ verify_voice() {
|
|
|
79
125
|
}
|
|
80
126
|
|
|
81
127
|
# @function get_voice_path
|
|
82
|
-
# @intent Get absolute path to voice model ONNX file
|
|
83
|
-
# @why Piper binary requires full path to model file
|
|
128
|
+
# @intent Get absolute path to voice model ONNX file for Piper binary
|
|
129
|
+
# @why Piper binary requires full absolute path to model file, not just voice name
|
|
84
130
|
# @param $1 {string} voice_name - Voice model name
|
|
85
|
-
# @returns Echoes path to .onnx file
|
|
131
|
+
# @returns Echoes absolute path to .onnx file to stdout
|
|
86
132
|
# @exitcode 0=success, 1=voice not found
|
|
87
|
-
# @sideeffects
|
|
133
|
+
# @sideeffects Writes error message to stderr if voice not found
|
|
134
|
+
# @edgecases Returns error if voice not downloaded yet
|
|
135
|
+
# @calledby play-tts-piper.sh for TTS synthesis
|
|
136
|
+
# @calls get_voice_storage_dir
|
|
88
137
|
get_voice_path() {
|
|
89
138
|
local voice_name="$1"
|
|
90
139
|
local voice_dir
|
|
@@ -100,13 +149,24 @@ get_voice_path() {
|
|
|
100
149
|
echo "$onnx_file"
|
|
101
150
|
}
|
|
102
151
|
|
|
152
|
+
# AI NOTE: Voice name format is: lang_LOCALE-speaker-quality
|
|
153
|
+
# Example: en_US-lessac-medium
|
|
154
|
+
# - lang: en (language code)
|
|
155
|
+
# - LOCALE: US (locale/country code)
|
|
156
|
+
# - speaker: lessac (speaker/voice name)
|
|
157
|
+
# - quality: medium (model quality: low/medium/high)
|
|
158
|
+
# HuggingFace repository structure: {lang}/{lang}_{LOCALE}/{speaker}/{quality}/
|
|
159
|
+
|
|
103
160
|
# @function parse_voice_components
|
|
104
|
-
# @intent Extract language, locale, speaker, quality from voice name
|
|
105
|
-
# @why HuggingFace uses directory
|
|
161
|
+
# @intent Extract language, locale, speaker, quality components from voice name
|
|
162
|
+
# @why HuggingFace uses structured directory paths based on these components
|
|
106
163
|
# @param $1 {string} voice_name - Voice name (e.g., en_US-lessac-medium)
|
|
107
|
-
# @returns
|
|
108
|
-
# @
|
|
109
|
-
#
|
|
164
|
+
# @returns None (sets global variables)
|
|
165
|
+
# @exitcode Always 0
|
|
166
|
+
# @sideeffects Sets global variables: LANG, LOCALE, SPEAKER, QUALITY
|
|
167
|
+
# @edgecases Expects specific format: lang_LOCALE-speaker-quality
|
|
168
|
+
# @calledby download_voice
|
|
169
|
+
# @calls None (pure string manipulation)
|
|
110
170
|
parse_voice_components() {
|
|
111
171
|
local voice_name="$1"
|
|
112
172
|
|
|
@@ -124,14 +184,16 @@ parse_voice_components() {
|
|
|
124
184
|
}
|
|
125
185
|
|
|
126
186
|
# @function download_voice
|
|
127
|
-
# @intent Download Piper voice model from HuggingFace
|
|
128
|
-
# @why Provide free offline TTS voices
|
|
129
|
-
# @param $1 {string} voice_name - Voice model name
|
|
130
|
-
# @param $2 {string} lang_code - Language code (optional, inferred from voice_name)
|
|
187
|
+
# @intent Download Piper voice model from HuggingFace repository
|
|
188
|
+
# @why Provide free offline TTS voices without requiring API keys
|
|
189
|
+
# @param $1 {string} voice_name - Voice model name (e.g., en_US-lessac-medium)
|
|
190
|
+
# @param $2 {string} lang_code - Language code (optional, inferred from voice_name, unused)
|
|
131
191
|
# @returns None
|
|
132
|
-
# @exitcode 0=success, 1=download failed
|
|
133
|
-
# @sideeffects Downloads .onnx and .onnx.json files
|
|
134
|
-
# @edgecases Handles network failures, validates file integrity
|
|
192
|
+
# @exitcode 0=success (already downloaded or newly downloaded), 1=download failed
|
|
193
|
+
# @sideeffects Downloads .onnx and .onnx.json files (~25MB total), removes partial downloads on failure
|
|
194
|
+
# @edgecases Handles network failures, validates file integrity (non-zero size), skips if already downloaded
|
|
195
|
+
# @calledby piper-download-voices.sh, manual voice download commands
|
|
196
|
+
# @calls parse_voice_components, verify_voice, get_voice_storage_dir, curl, rm
|
|
135
197
|
download_voice() {
|
|
136
198
|
local voice_name="$1"
|
|
137
199
|
local lang_code="${2:-}"
|
|
@@ -187,11 +249,15 @@ download_voice() {
|
|
|
187
249
|
}
|
|
188
250
|
|
|
189
251
|
# @function list_downloaded_voices
|
|
190
|
-
# @intent
|
|
191
|
-
# @why Help users see what voices they have available
|
|
192
|
-
# @
|
|
193
|
-
# @
|
|
194
|
-
# @
|
|
252
|
+
# @intent Display all locally cached voice models with file sizes
|
|
253
|
+
# @why Help users see what voices they have available and storage usage
|
|
254
|
+
# @param None
|
|
255
|
+
# @returns None
|
|
256
|
+
# @exitcode Always 0
|
|
257
|
+
# @sideeffects Writes formatted list to stdout
|
|
258
|
+
# @edgecases Handles empty voice directory gracefully, uses nullglob to avoid literal *.onnx
|
|
259
|
+
# @calledby Voice management commands, /agent-vibes:list
|
|
260
|
+
# @calls get_voice_storage_dir, basename, du
|
|
195
261
|
list_downloaded_voices() {
|
|
196
262
|
local voice_dir
|
|
197
263
|
voice_dir=$(get_voice_storage_dir)
|
|
@@ -1,12 +1,38 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
3
|
+
# File: .claude/hooks/play-tts-elevenlabs.sh
|
|
4
|
+
#
|
|
5
|
+
# AgentVibes - Finally, your AI Agents can Talk Back! Text-to-Speech WITH personality for AI Assistants!
|
|
6
|
+
# Website: https://agentvibes.org
|
|
7
|
+
# Repository: https://github.com/paulpreibisch/AgentVibes
|
|
8
|
+
#
|
|
9
|
+
# Co-created by Paul Preibisch with Claude AI
|
|
10
|
+
# Copyright (c) 2025 Paul Preibisch
|
|
11
|
+
#
|
|
12
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
# you may not use this file except in compliance with the License.
|
|
14
|
+
# You may obtain a copy of the License at
|
|
15
|
+
#
|
|
16
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
#
|
|
18
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
# See the License for the specific language governing permissions and
|
|
22
|
+
# limitations under the License.
|
|
23
|
+
#
|
|
24
|
+
# DISCLAIMER: This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
# express or implied. Use at your own risk. See the Apache License for details.
|
|
26
|
+
#
|
|
27
|
+
# ---
|
|
28
|
+
#
|
|
29
|
+
# @fileoverview ElevenLabs TTS Provider Implementation - Premium cloud-based TTS
|
|
30
|
+
# @context Provider-specific implementation for ElevenLabs API integration with multilingual support
|
|
31
|
+
# @architecture Part of multi-provider TTS system - implements provider interface contract
|
|
6
32
|
# @dependencies Requires ELEVENLABS_API_KEY, curl, ffmpeg, paplay/aplay/mpg123, jq
|
|
7
|
-
# @entrypoints Called by play-tts.sh router with ($1=text, $2=voice_name)
|
|
8
|
-
# @patterns Follows provider contract: accept text/voice, output audio file path
|
|
9
|
-
# @related play-tts.sh, provider-manager.sh, GitHub Issue #25
|
|
33
|
+
# @entrypoints Called by play-tts.sh router with ($1=text, $2=voice_name) when provider=elevenlabs
|
|
34
|
+
# @patterns Follows provider contract: accept text/voice, output audio file path, API error handling, SSH audio optimization
|
|
35
|
+
# @related play-tts.sh, provider-manager.sh, voices-config.sh, language-manager.sh, GitHub Issue #25
|
|
10
36
|
#
|
|
11
37
|
|
|
12
38
|
# Fix locale warnings
|
|
@@ -1,12 +1,38 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
3
|
+
# File: .claude/hooks/play-tts-piper.sh
|
|
4
|
+
#
|
|
5
|
+
# AgentVibes - Finally, your AI Agents can Talk Back! Text-to-Speech WITH personality for AI Assistants!
|
|
6
|
+
# Website: https://agentvibes.org
|
|
7
|
+
# Repository: https://github.com/paulpreibisch/AgentVibes
|
|
8
|
+
#
|
|
9
|
+
# Co-created by Paul Preibisch with Claude AI
|
|
10
|
+
# Copyright (c) 2025 Paul Preibisch
|
|
11
|
+
#
|
|
12
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
# you may not use this file except in compliance with the License.
|
|
14
|
+
# You may obtain a copy of the License at
|
|
15
|
+
#
|
|
16
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
#
|
|
18
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
# See the License for the specific language governing permissions and
|
|
22
|
+
# limitations under the License.
|
|
23
|
+
#
|
|
24
|
+
# DISCLAIMER: This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
# express or implied. Use at your own risk. See the Apache License for details.
|
|
26
|
+
#
|
|
27
|
+
# ---
|
|
28
|
+
#
|
|
29
|
+
# @fileoverview Piper TTS Provider Implementation - Free, offline neural TTS
|
|
30
|
+
# @context Provides local, privacy-first TTS alternative to cloud services for WSL/Linux
|
|
31
|
+
# @architecture Implements provider interface contract for Piper binary integration
|
|
32
|
+
# @dependencies piper (pipx), piper-voice-manager.sh, mpv/aplay, ffmpeg (optional padding)
|
|
33
|
+
# @entrypoints Called by play-tts.sh router when provider=piper
|
|
34
|
+
# @patterns Provider contract: text/voice → audio file path, voice auto-download, language-aware synthesis
|
|
35
|
+
# @related play-tts.sh, piper-voice-manager.sh, language-manager.sh, GitHub Issue #25
|
|
10
36
|
#
|
|
11
37
|
|
|
12
38
|
# Fix locale warnings
|
|
@@ -49,8 +75,8 @@ else
|
|
|
49
75
|
|
|
50
76
|
if [[ -n "$VOICE_FILE" ]]; then
|
|
51
77
|
FILE_VOICE=$(cat "$VOICE_FILE" 2>/dev/null)
|
|
52
|
-
# Check if it's a Piper model name (contains underscore and dash)
|
|
53
|
-
if [[ "$FILE_VOICE" == *"_"*"-"* ]]; then
|
|
78
|
+
# Check if it's a Piper model name (contains underscore and dash, or speaker ID with #)
|
|
79
|
+
if [[ "$FILE_VOICE" == *"_"*"-"* ]] || [[ "$FILE_VOICE" == *"#"* ]]; then
|
|
54
80
|
VOICE_MODEL="$FILE_VOICE"
|
|
55
81
|
fi
|
|
56
82
|
fi
|
|
@@ -92,7 +118,21 @@ fi
|
|
|
92
118
|
# @param Uses global: $VOICE_MODEL
|
|
93
119
|
# @sideeffects Downloads voice model files
|
|
94
120
|
# @edgecases Prompts user for consent before downloading
|
|
95
|
-
|
|
121
|
+
|
|
122
|
+
# Strip speaker ID for verification/download (speaker ID is after #)
|
|
123
|
+
VOICE_MODEL_BASE="$VOICE_MODEL"
|
|
124
|
+
if [[ "$VOICE_MODEL" == *"#"* ]]; then
|
|
125
|
+
VOICE_MODEL_BASE="${VOICE_MODEL%%#*}"
|
|
126
|
+
fi
|
|
127
|
+
|
|
128
|
+
# Check if custom voice exists (bypass verification for custom voices)
|
|
129
|
+
CUSTOM_VOICE_PATH="$HOME/.local/share/piper/voices/$VOICE_MODEL_BASE.onnx"
|
|
130
|
+
IS_CUSTOM_VOICE=false
|
|
131
|
+
if [[ -f "$CUSTOM_VOICE_PATH" ]]; then
|
|
132
|
+
IS_CUSTOM_VOICE=true
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
if [[ "$IS_CUSTOM_VOICE" == "false" ]] && ! verify_voice "$VOICE_MODEL_BASE"; then
|
|
96
136
|
echo "📥 Voice model not found: $VOICE_MODEL"
|
|
97
137
|
echo " File size: ~25MB"
|
|
98
138
|
echo " Preview: https://huggingface.co/rhasspy/piper-voices"
|
|
@@ -101,7 +141,7 @@ if ! verify_voice "$VOICE_MODEL"; then
|
|
|
101
141
|
echo
|
|
102
142
|
|
|
103
143
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
104
|
-
if ! download_voice "$
|
|
144
|
+
if ! download_voice "$VOICE_MODEL_BASE"; then
|
|
105
145
|
echo "❌ Failed to download voice model"
|
|
106
146
|
echo "Fix: Download manually or choose different voice"
|
|
107
147
|
exit 3
|
|
@@ -112,11 +152,19 @@ if ! verify_voice "$VOICE_MODEL"; then
|
|
|
112
152
|
fi
|
|
113
153
|
fi
|
|
114
154
|
|
|
115
|
-
# Get voice model path
|
|
116
|
-
|
|
155
|
+
# Get voice model path (use base model without speaker ID)
|
|
156
|
+
# Suppress stderr from get_voice_path since we have custom voice fallback
|
|
157
|
+
VOICE_PATH=$(get_voice_path "$VOICE_MODEL_BASE" 2>/dev/null)
|
|
117
158
|
if [[ $? -ne 0 ]]; then
|
|
118
|
-
|
|
119
|
-
|
|
159
|
+
# Try custom voice in piper voices directory
|
|
160
|
+
CUSTOM_PATH="$HOME/.local/share/piper/voices/$VOICE_MODEL_BASE.onnx"
|
|
161
|
+
if [[ -f "$CUSTOM_PATH" ]]; then
|
|
162
|
+
VOICE_PATH="$CUSTOM_PATH"
|
|
163
|
+
echo "🎤 Using custom voice: $VOICE_MODEL_BASE"
|
|
164
|
+
else
|
|
165
|
+
echo "❌ Voice model path not found: $VOICE_MODEL"
|
|
166
|
+
exit 3
|
|
167
|
+
fi
|
|
120
168
|
fi
|
|
121
169
|
|
|
122
170
|
# @function determine_audio_directory
|
|
@@ -206,12 +254,25 @@ SPEECH_RATE=$(get_speech_rate)
|
|
|
206
254
|
# @function synthesize_with_piper
|
|
207
255
|
# @intent Generate speech using Piper TTS
|
|
208
256
|
# @why Provides free, offline TTS alternative
|
|
209
|
-
# @param Uses globals: $TEXT, $VOICE_PATH, $SPEECH_RATE
|
|
257
|
+
# @param Uses globals: $TEXT, $VOICE_PATH, $SPEECH_RATE, $VOICE_MODEL
|
|
210
258
|
# @returns Creates WAV file at $TEMP_FILE
|
|
211
259
|
# @exitcode 0=success, 4=synthesis error
|
|
212
260
|
# @sideeffects Creates audio file
|
|
213
|
-
# @edgecases Handles piper errors, invalid models
|
|
214
|
-
|
|
261
|
+
# @edgecases Handles piper errors, invalid models, speaker IDs
|
|
262
|
+
|
|
263
|
+
# Check if voice model includes speaker ID (format: modelname#speakerID)
|
|
264
|
+
SPEAKER_ID=""
|
|
265
|
+
if [[ "$VOICE_MODEL" == *"#"* ]]; then
|
|
266
|
+
SPEAKER_ID="${VOICE_MODEL##*#}"
|
|
267
|
+
VOICE_MODEL="${VOICE_MODEL%%#*}"
|
|
268
|
+
fi
|
|
269
|
+
|
|
270
|
+
# Build piper command with optional speaker parameter
|
|
271
|
+
if [[ -n "$SPEAKER_ID" ]]; then
|
|
272
|
+
echo "$TEXT" | piper --model "$VOICE_PATH" --speaker "$SPEAKER_ID" --length-scale "$SPEECH_RATE" --output_file "$TEMP_FILE" 2>/dev/null
|
|
273
|
+
else
|
|
274
|
+
echo "$TEXT" | piper --model "$VOICE_PATH" --length-scale "$SPEECH_RATE" --output_file "$TEMP_FILE" 2>/dev/null
|
|
275
|
+
fi
|
|
215
276
|
|
|
216
277
|
if [[ ! -f "$TEMP_FILE" ]] || [[ ! -s "$TEMP_FILE" ]]; then
|
|
217
278
|
echo "❌ Failed to synthesize speech with Piper"
|
|
@@ -1,11 +1,42 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
#
|
|
3
|
+
# File: .claude/hooks/play-tts.sh
|
|
4
|
+
#
|
|
5
|
+
# AgentVibes - Finally, your AI Agents can Talk Back! Text-to-Speech WITH personality for AI Assistants!
|
|
6
|
+
# Website: https://agentvibes.org
|
|
7
|
+
# Repository: https://github.com/paulpreibisch/AgentVibes
|
|
8
|
+
#
|
|
9
|
+
# Co-created by Paul Preibisch with Claude AI
|
|
10
|
+
# Copyright (c) 2025 Paul Preibisch
|
|
11
|
+
#
|
|
12
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
# you may not use this file except in compliance with the License.
|
|
14
|
+
# You may obtain a copy of the License at
|
|
15
|
+
#
|
|
16
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
#
|
|
18
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
# See the License for the specific language governing permissions and
|
|
22
|
+
# limitations under the License.
|
|
23
|
+
#
|
|
24
|
+
# DISCLAIMER: This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
# express or implied, including but not limited to the warranties of
|
|
26
|
+
# merchantability, fitness for a particular purpose and noninfringement.
|
|
27
|
+
# In no event shall the authors or copyright holders be liable for any claim,
|
|
28
|
+
# damages or other liability, whether in an action of contract, tort or
|
|
29
|
+
# otherwise, arising from, out of or in connection with the software or the
|
|
30
|
+
# use or other dealings in the software.
|
|
31
|
+
#
|
|
32
|
+
# ---
|
|
33
|
+
#
|
|
3
34
|
# @fileoverview TTS Provider Router with Language Learning Support
|
|
4
35
|
# @context Routes TTS requests to active provider (ElevenLabs or Piper)
|
|
5
36
|
# @architecture Provider abstraction layer - single entry point for all TTS
|
|
6
|
-
# @dependencies provider-manager.sh, play-tts-elevenlabs.sh, play-tts-piper.sh,
|
|
7
|
-
# @entrypoints Called by hooks, slash commands,
|
|
8
|
-
# @patterns Provider pattern - delegates to provider-specific implementations
|
|
37
|
+
# @dependencies provider-manager.sh, play-tts-elevenlabs.sh, play-tts-piper.sh, github-star-reminder.sh
|
|
38
|
+
# @entrypoints Called by hooks, slash commands, personality-manager.sh, and all TTS features
|
|
39
|
+
# @patterns Provider pattern - delegates to provider-specific implementations, auto-detects provider from voice name
|
|
9
40
|
# @related provider-manager.sh, play-tts-elevenlabs.sh, play-tts-piper.sh, learn-manager.sh
|
|
10
41
|
#
|
|
11
42
|
|