Improve Local TTS
Because science fiction dystopias are irresistible
July 2025
MacOS's say command is a surprisingly useful addition for local shell scripts:
say "$(total) packages updated!"
It uses your configured Settings > Accessibility > Spoken Content voice to speak anything you pass it. But even the best voices (IMO, the "Siri" ones) still sound disappointingly robotic.
Better
Enter mlx-audio and kokoro:
alias tts='mlx_audio.tts.generate --model mlx-community/Kokoro-82M-4bit --stream --speed 1.25 --voice af_sky'
# Then...
tts --text "Do you recognize this voice? I bet you do."
# Or...
cat some-file.txt | tts
This alias uses a local MLX model to generate remarkably realistic sounding voices, in nearly realtime, on any recent M-series mac.
Installation
As of July 2025, installation requires some magic version numbers:
uv tool install mlx-audio --with pip --with mlx-vlm==0.1.26 --with mlx-lm==0.24.1
Which adds mlx-audio.* commands.
Running any command with --model and --voice will automatically download the necessary files from Hugging Face. These will be stored at ~/.cache/huggingface/hub.