MLX TTS
Text-To-Speech with MLX (Apple Silicon) and open-source models (default QWen3-TTS) locally.
Free and Fast. No API key required. No server required.
Requirements
- -
mlx: macOS with Apple Silicon - INLINECODE1 : used to install deps if not available
Installation
CODEBLOCK0
This script will use brew to install these CLI tools if not available:
- -
uv: install python package and run python script - INLINECODE4 : do the real job
Usage
To generate audio from text, run this script:
CODEBLOCK1
Agent Instructions
- 1. Run the script: Pass the text to be spoken as an argument.
- Handle Output: The script will output a path to a audio file.
Use the
message tool to send the audio file to the user as an voice message:
CODEBLOCK2
Example:
User: "Say hello world"
Agent:
- 1. Runs INLINECODE6
- Receives output: INLINECODE7
- Calls INLINECODE8
MLX TTS
在本地使用 MLX(Apple Silicon)和开源模型(默认 QWen3-TTS)进行文本转语音。
免费且快速。无需 API 密钥,无需服务器。
系统要求
- - mlx:配备 Apple Silicon 的 macOS
- brew:用于安装依赖(如果尚未安装)
安装
bash
bash ${baseDir}/install.sh
如果以下 CLI 工具尚未安装,该脚本将使用 brew 进行安装:
- - uv:安装 Python 包并运行 Python 脚本
- mlx_audio:执行实际任务
使用方法
要从文本生成音频,请运行以下脚本:
bash
bash ${baseDir}/mlx-tts.sh <文本>
智能体指令
- 1. 运行脚本:将要朗读的文本作为参数传入。
- 处理输出:脚本将输出音频文件的路径。
使用 message 工具将音频文件作为语音消息发送给用户:
json
{
action: send,
filePath: <文件路径>
}
示例:
用户:说你好世界
智能体:
- 1. 运行 bash path/to/mlx-tts.sh 你好世界
- 接收输出:/tmp/folder/audio.ogg
- 调用 message(action=send, filePath=/tmp/folder/audio.ogg, ...)