Skip to content

neutrl/say

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

macOS Text-to-Speech Tool

A beautiful, interactive shell script that makes using macOS's built-in say command easier and more user-friendly.

Features

  • 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

Requirements

  • macOS (uses the built-in say command)
  • Shell with ANSI color support (most modern terminals)

Installation

  1. Download the script:
curl -O https://raw.githubusercontent.com/YOUR_USERNAME/say/main/say.sh
  1. Make it executable:
chmod +x say.sh
  1. (Optional) Move to your PATH for easy access:
sudo mv say.sh /usr/local/bin/say-interactive

Usage

Run the script:

./say.sh

The script will guide you through an interactive process:

Step 1: Input

Choose one of two options:

  • Enter a message directly - type text to be spoken
  • Use a file - press Enter and provide a file path

Step 2: Output

  • Save to file - enter a filename to save as AIFF audio
  • Just speak - press Enter to only speak without saving

Step 3: Voice Selection

  • Browse the list of available voices
  • Enter a voice name (e.g., "Samantha", "Alex", "Daniel")
  • Press Enter to use the default voice (Samantha)

Step 4: Processing

The script will speak your text and/or save the audio file.

Examples

Speak a message with default voice

Please enter your message: Hello, world!
File to save to (blank for none): [Enter]
Which voice? (blank for default): [Enter]

Read from file and save audio

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

Custom voice without saving

Please enter your message: This is a test
File to save to (blank for none): [Enter]
Which voice? (blank for default): Samantha

Features in Detail

Voice Validation

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.

File Validation

  • Checks if input files exist and are readable
  • Warns before overwriting existing output files
  • Automatically adds .aiff extension to output files

Smart Error Handling

  • Clear error messages with context
  • Validates say command success
  • Prevents common mistakes

Visual Feedback

  • 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

Available Voices

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!

Troubleshooting

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

Contributing

Contributions are welcome! Feel free to:

  • Report bugs
  • Suggest new features
  • Submit pull requests

License

MIT License - see LICENSE file for details.

Author

Created with attention to user experience and code quality.

About

bash script utilizing macOS speak function

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages