speak

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/speak - Text-to-Speech

/speak - 文本转语音

Speak text using edge-tts (high-quality neural voices) with fallback to macOS
say
.
使用edge-tts(高品质神经语音)进行文本朗读,备选方案为macOS
say
命令。

Quick Start

快速开始

bash
/speak "Hello world"                    # Default English voice
/speak --thai "สวัสดีครับ"                # Thai voice
/speak --voice "en-GB-RyanNeural" "Hi"  # Specific voice
/speak --mac "Hello"                    # Force macOS say
bash
/speak "Hello world"                    # 默认英文语音
/speak --thai "สวัสดีครับ"                # 泰语语音
/speak --voice "en-GB-RyanNeural" "Hi"  # 指定语音
/speak --mac "Hello"                    # 强制使用macOS say

Options

选项

OptionDescription
--thai
Use Thai voice (th-TH-NiwatNeural)
--female
Use female voice
--voice NAME
Specific edge-tts voice
--mac
Force macOS say command
--rate RATE
Speech rate (edge-tts: +/-50%, mac: 100-300)
--list
List available voices
选项说明
--thai
使用泰语语音(th-TH-NiwatNeural)
--female
使用女性语音
--voice NAME
指定edge-tts语音
--mac
强制使用macOS say命令
--rate RATE
语速(edge-tts:±50%,mac:100-300)
--list
列出可用语音

Default Voices

默认语音

LanguageVoice
Englishen-US-GuyNeural (male)
Englishen-US-JennyNeural (female)
Thaith-TH-NiwatNeural (male)
Thaith-TH-PremwadeeNeural (female)
语言语音
英语en-US-GuyNeural(男性)
英语en-US-JennyNeural(女性)
泰语th-TH-NiwatNeural(男性)
泰语th-TH-PremwadeeNeural(女性)

Scripts

脚本

Located in
src/skills/speak/scripts/
:
ScriptPurpose
speak.ts
Main TTS script
位于
src/skills/speak/scripts/
脚本用途
speak.ts
主TTS脚本

Run Script

运行脚本

bash
cd src/skills/speak/scripts
bun speak.ts "Text to speak"
bun speak.ts --thai "ภาษาไทย"
bun speak.ts --list
bash
cd src/skills/speak/scripts
bun speak.ts "Text to speak"
bun speak.ts --thai "ภาษาไทย"
bun speak.ts --list

Requirements

依赖要求

  • edge-tts:
    pip install edge-tts
    (optional, for high-quality voices)
  • macOS say: Built-in (fallback)
  • edge-tts
    pip install edge-tts
    (可选,用于高品质语音)
  • macOS say:系统内置(备选方案)

How It Works

工作原理

  1. Check if edge-tts is available
  2. If yes: Use edge-tts with neural voice
  3. If no: Fall back to macOS
    say
    command
  4. Play audio through default output
  1. 检查edge-tts是否可用
  2. 若可用:使用edge-tts的神经语音
  3. 若不可用:切换至macOS
    say
    命令
  4. 通过默认输出设备播放音频

Examples

示例

bash
undefined
bash
undefined

Speak Gemini response

朗读Gemini响应

/speak "The answer is 42"
/speak "The answer is 42"

Thai greeting

泰语问候

/speak --thai "สวัสดีครับ ยินดีต้อนรับ"
/speak --thai "สวัสดีครับ ยินดีต้อนรับ"

British accent

英式口音

/speak --voice "en-GB-RyanNeural" "Brilliant!"
/speak --voice "en-GB-RyanNeural" "Brilliant!"

List all voices

列出所有可用语音

/speak --list
undefined
/speak --list
undefined