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, ...)