A beautiful, interactive shell script that makes using macOS's built-in say command easier and more user-friendly.
- Interactive prompts with colorful, easy-to-read interface
- Flexible input - speak text directly or read from a file
- Voice selection - choose from all available macOS voices
- Audio export - save speech as AIFF audio files
- Smart validation - checks for file existence, voice availability, and file overwrites
- Error handling - clear error messages and graceful failures
- Cross-platform paths - works with any file path, not just Desktop
- macOS (uses the built-in
saycommand) - Shell with ANSI color support (most modern terminals)
- Download the script:
curl -O https://raw.githubusercontent.com/YOUR_USERNAME/say/main/say.sh- Make it executable:
chmod +x say.sh- (Optional) Move to your PATH for easy access:
sudo mv say.sh /usr/local/bin/say-interactiveRun the script:
./say.shThe script will guide you through an interactive process:
Choose one of two options:
- Enter a message directly - type text to be spoken
- Use a file - press Enter and provide a file path
- Save to file - enter a filename to save as AIFF audio
- Just speak - press Enter to only speak without saving
- Browse the list of available voices
- Enter a voice name (e.g., "Samantha", "Alex", "Daniel")
- Press Enter to use the default voice (Samantha)
The script will speak your text and/or save the audio file.
Please enter your message: Hello, world!
File to save to (blank for none): [Enter]
Which voice? (blank for default): [Enter]
Please enter your message: [Enter]
Enter the path to input file: ~/Documents/speech.txt
File to save to (blank for none): my-speech
Which voice? (blank for default): Alex
Please enter your message: This is a test
File to save to (blank for none): [Enter]
Which voice? (blank for default): Samantha
The script validates that your chosen voice exists. If you enter an invalid voice name, it falls back to the default (Samantha) with a warning.
- Checks if input files exist and are readable
- Warns before overwriting existing output files
- Automatically adds
.aiffextension to output files
- Clear error messages with context
- Validates
saycommand success - Prevents common mistakes
- Color-coded messages (errors in red, success in green, warnings in yellow)
- Section headers for clear organization
- Status icons (✓, ⚠, ✗, ♪) for quick scanning
- Proper indentation and spacing
Run say -v ? in your terminal to see all available voices on your system. Common voices include:
- Alex (default US English male)
- Samantha (US English female)
- Daniel (UK English male)
- Fiona (UK English female)
- Victoria (US English female)
- And many more in different languages!
Colors not showing?
- Make sure your terminal supports ANSI colors
- Most modern terminals (Terminal.app, iTerm2, etc.) support this by default
Voice not found?
- Check the spelling matches exactly (case-sensitive)
- Run
say -v ?to see available voices - Some voices may need to be downloaded in System Preferences > Accessibility > Spoken Content
File permission errors?
- Ensure you have read permissions for input files
- Ensure you have write permissions for the output directory
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
MIT License - see LICENSE file for details.
Created with attention to user experience and code quality.