Voice Wake Say
Overview
Use macOS
say to read the assistant's response out loud whenever the conversation came from Voice Wake/voice recognition. Do
not use the
tts tool (it calls cloud providers).
When to Use say (CHECK EVERY MESSAGE INDIVIDUALLY)
IF the user message STARTS WITH: User talked via voice recognition
- - Step 1: Acknowledge with
say first (so the user knows you heard them) - Step 2: Then perform the task
- Step 3: Optionally speak again when done if it makes sense
IF the user message does NOT start with that exact phrase
- - THEN: Do NOT use
say. Text-only response only.
Critical:
- - Check EACH message individually — context does NOT carry over
- The trigger phrase must be at the VERY START of the message
- For tasks that take time, acknowledge FIRST so the user knows you're working
Workflow
1) Detect Voice Wake context
- - Trigger ONLY when the latest user/system message STARTS WITH INLINECODE6
- If the message instructs "repeat prompt first", keep that behavior in the response.
2) Prepare spoken text
- - Use the final response text as the basis.
- Strip markdown/code blocks; if the response is long or code-heavy, speak a short summary and mention that details are on screen.
3) Speak with say (local macOS TTS)
CODEBLOCK0
Optional controls (use only if set):
CODEBLOCK1
Failure handling
- - If
say is unavailable or errors, still send the text response and note that TTS failed.
语音唤醒播报
概述
当对话来自语音唤醒/语音识别时,使用macOS的say命令将助手的回复朗读出来。
不要使用tts工具(它会调用云服务商)。
何时使用say(逐条检查每条消息)
如果用户消息以以下内容开头:用户通过语音识别发言
- - 步骤1: 先用say进行确认(让用户知道您已听到)
- 步骤2: 然后执行任务
- 步骤3: 任务完成后,若合理可再次语音播报
如果用户消息不以该确切短语开头
关键要点:
- - 逐条检查每条消息——上下文不会延续
- 触发短语必须位于消息的最开头
- 对于耗时任务,先进行确认,让用户知道您正在处理
工作流程
1) 检测语音唤醒上下文
- - 仅当最新用户/系统消息以用户通过语音识别发言开头时触发
- 如果消息指示先重复提示,请在回复中保留该行为。
2) 准备朗读文本
- - 以最终回复文本为基础。
- 去除Markdown/代码块;如果回复内容较长或代码较多,则朗读简短摘要并说明详细信息显示在屏幕上。
3) 使用say进行朗读(本地macOS TTS)
bash
printf %s $朗读文本 | say
可选控制参数(仅在已设置时使用):
bash
printf %s $朗读文本 | say -v $语音角色
printf %s $朗读文本 | say -r $语速
故障处理
- - 如果say不可用或出错,仍发送文本回复,并注明TTS朗读失败。