A macOS-style say command for Linux/WSL2, powered by piper-tts. Fast, local, offline text-to-speech with natural-sounding voices.
git clone https://github.com/kd5ziy/say4linux.git
cd say4linux
bash install.sh
say "Hello from say4linux"That's it! The installer handles everything: piper-tts, a default voice model, and PATH setup.
say— drop-in replacement for the macOSsaycommandinstall.sh— automated installer (piper-tts + default voice + symlink)download-voices.sh— download additional US/UK English voicessample-voices.sh— interactive voice sampler to find your favoriteuninstall.sh— clean removal
| Requirement | Why | Install |
|---|---|---|
| Python 3.7+ | Runs say.py | sudo apt install python3 python3-venv |
| wget | Downloads voice models | sudo apt install wget |
| PulseAudio or ALSA | Plays audio | sudo apt install pulseaudio-utils or sudo apt install alsa-utils |
On WSL2, PulseAudio is typically available if you're running WSLg (Windows 11). For older setups, see WSL2 Audio Setup below.
If you prefer to install manually instead of using install.sh:
1. Install piper-tts
sudo python3 -m venv /opt/piper-tts
sudo /opt/piper-tts/bin/pip install --upgrade pip
sudo /opt/piper-tts/bin/pip install piper-tts2. Download a voice model
# Download just the default voice (en_US-amy-medium)
bash download-voices.sh en_US/amy/medium
# Or download all US voices
bash download-voices.sh --us
# Or download everything (US + UK, all qualities)
bash download-voices.sh --all3. Install the say command
mkdir -p ~/.local/bin ~/.local/share/say4linux
cp say.py ~/.local/share/say4linux/say.py
chmod +x ~/.local/share/say4linux/say.py
ln -sf ~/.local/share/say4linux/say.py ~/.local/bin/say4. Ensure ~/.local/bin is in your PATH
Add to your ~/.bashrc or ~/.zshrc:
export PATH="${HOME}/.local/bin:${PATH}"Then reload: source ~/.bashrc
# Basic usage
say "Hello world"
# Pipe text in
echo "The build succeeded" | say
# Choose a voice
say -v en_US-amy-medium "Amy speaking"
say -v en_GB-alba-medium "British voice"
# List installed voices
say -v list
# Save to WAV file instead of playing
say -o greeting.wav "Hello world"
# Adjust speaking rate (0.5 = slow, 2.0 = fast)
say -r 1.5 "Speaking faster"
say -r 0.7 "Speaking slower"Voices follow the naming pattern: LANG-SPEAKER-QUALITY
| Quality | Size | Best for |
|---|---|---|
low |
~15 MB | Fastest, lower quality |
medium |
~60 MB | Good balance (recommended) |
high |
~100 MB | Best quality, slower |
Not sure which voice you like? Use the interactive voice sampler:
bash sample-voices.shIt plays each installed voice one at a time. You can replay, mark favorites, and skip. When you find one you like, set it as your default:
# Add to ~/.bashrc or ~/.zshrc
alias say='say -v en_GB-alba-medium'# See what's available to download
bash download-voices.sh --list
# Download specific voice
bash download-voices.sh en_US/ryan/high
# Download all US voices
bash download-voices.sh --us
# Download all UK voices
bash download-voices.sh --uk
# Download everything
bash download-voices.sh --allSet SAY4LINUX_MODELS to use a different location:
export SAY4LINUX_MODELS="/path/to/my/models"The command searches for models in this order:
$SAY4LINUX_MODELS(if set)~/.local/share/say4linux/models/mnt/c/tts/models(WSL2 legacy path)
say works perfectly as a Claude Code hook for audio notifications while coding.
Copy examples/claude-hooks.json into your Claude settings, or add hooks manually to ~/.claude/settings.json:
{
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [
{ "type": "command", "command": "say 'Claude has finished'" }
]
}
],
"Notification": [
{
"matcher": "idle_prompt",
"hooks": [
{ "type": "command", "command": "say 'Claude is waiting for input'" }
]
},
{
"matcher": "permission_prompt",
"hooks": [
{ "type": "command", "command": "say 'Claude needs permission'" }
]
}
],
"PostToolUse": [
{
"matcher": "Bash",
"hooks": [
{ "type": "command", "command": "say 'Command complete'" }
]
}
],
"SubagentStop": [
{
"matcher": "",
"hooks": [
{ "type": "command", "command": "say 'Agent task complete'" }
]
}
],
"TaskCompleted": [
{
"matcher": "",
"hooks": [
{ "type": "command", "command": "say 'Task completed'" }
]
}
]
}
}Available hook events: Stop, Notification, PostToolUse, PreToolUse, SubagentStop, TaskCompleted, SessionStart, SessionEnd, and more. See the full example in examples/claude-hooks.json.
This repo includes three Claude Code skills in .claude/skills/:
| Command | Description |
|---|---|
/say [text] |
Speak text aloud using say4linux |
/list-voices |
List all installed voices, grouped by language and quality |
/say-test [voice] [text] |
Test a specific voice with sample text |
To use these skills, clone this repo and open it with Claude Code — the skills are picked up automatically from .claude/skills/.
# Inside Claude Code:
/list-voices
/say-test en_GB-alba-medium "Testing the British voice"The MCP (Model Context Protocol) server lets any MCP-compatible client use say4linux as a tool — Claude Code, Claude Desktop, Cursor, and more.
# Install the MCP server dependencies
bash setup-mcp.sh| Tool | Description |
|---|---|
say |
Speak text aloud on the host machine |
list_available_voices |
List all installed voice models |
save_audio |
Synthesize text to a WAV file |
Project-local (auto-detected when you open this repo):
The .mcp.json file in this repo registers the server automatically. Just run bash setup-mcp.sh first, then open the project in Claude Code.
Global (available from any project):
claude mcp add -s user say4linux /path/to/say4linux/mcp_venv/bin/python /path/to/say4linux/mcp_server.pyAdd to your claude_desktop_config.json:
{
"mcpServers": {
"say4linux": {
"command": "/path/to/say4linux/mcp_venv/bin/python",
"args": ["/path/to/say4linux/mcp_server.py"]
}
}
}Any MCP-compatible client can use the server via stdio transport:
command: /path/to/say4linux/mcp_venv/bin/python
args: /path/to/say4linux/mcp_server.py
On Windows 11 with WSLg, audio should work out of the box via PulseAudio.
On Windows 10 or older WSL2 setups, you need to forward audio to Windows:
- Install PulseAudio for Windows
- In WSL2, configure PulseAudio to connect to the Windows host:
Add that line to your
export PULSE_SERVER=tcp:$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}')
~/.bashrcfor persistence.
| Problem | Solution |
|---|---|
say: command not found |
Ensure ~/.local/bin is in your PATH |
ERROR: 'piper' not found |
Run install.sh or install piper-tts manually |
ERROR: Voice not found |
Run say -v list to check installed voices; use download-voices.sh to get more |
| No sound on WSL2 | Check paplay --version; see WSL2 Audio Setup |
| Audio choppy/distorted | Try a low quality model or check PulseAudio config |
bash uninstall.shThis removes the say symlink and optionally the model files. piper-tts at /opt/piper-tts is left in place (remove manually with sudo rm -rf /opt/piper-tts).
This project is built on these open-source projects:
- piper — A fast, local neural text-to-speech system by Michael Hansen (rhasspy). Licensed under the MIT License.
- piper-voices — Pre-trained voice models for piper, hosted on Hugging Face. Individual voice models have their own licenses; see the piper-voices repository for details.
- piper-tts — Python package wrapping the piper engine.
MIT