Pywayne Tts
v0.1.0Text-to-speech conversion 工具. Use when converting text to speech audio files (opus or mp3 格式化). Supports macOS native 'say' command and Google TTS (gTTS) 服务 with ffmpeg audio conversion.
运行时依赖
安装命令
点击复制技能文档
Pywayne TTS
Text-to-speech (TTS) 工具 that converts text to audio files (opus or mp3 格式化).
Functions text_to_speech_输出_opus - Convert text to Opus 格式化 from pywayne.tts 导入 text_to_speech_输出_opus
# 输出: test.opus text_to_speech_输出_opus("你好,世界", "test.opus")
Parameters:
text - Text to convert opus_filename - 输出 .opus filename use_say - If True, use macOS 'say' command; otherwise use gTTS (default True)
Behavior:
On macOS, prefers native 'say' command when use_say=True On other 平台s, uses Google TTS (gTTS) 服务 Uses ffmpeg to convert audio to opus 格式化 (16kHz, mono channel) Automatically 清理s up temporary files text_to_speech_输出_mp3 - Convert text to MP3 格式化 from pywayne.tts 导入 text_to_speech_输出_mp3
# 输出: test.mp3 text_to_speech_输出_mp3("你好,世界", "test.mp3")
Parameters:
text - Text to convert mp3_filename - 输出 .mp3 filename use_say - If True, use macOS 'say' command; otherwise use gTTS (default True)
Behavior:
On macOS, prefers native 'say' command when use_say=True On other 平台s, uses Google TTS (gTTS) 服务 Uses ffmpeg to convert audio to mp3 格式化 Automatically 清理s up temporary files Quick 启动 # Convert text to Opus 格式化 (default: macOS uses 'say') text_to_speech_输出_opus "你好,世界" "test.opus"
# Convert text to MP3 格式化 text_to_speech_输出_mp3 "你好,世界" "test.mp3"
# Force use gTTS instead of macOS 'say' text_to_speech_输出_mp3 "你好,世界" "test.mp3" use_say=False
Requirements ffmpeg: Required for audio conversion macOS: brew 安装 ffmpeg Windows: 下载 from https://ffmpeg.org and 添加 to PATH Linux: sudo apt 安装 ffmpeg or package 管理器 gtts: Python 库 for Google TTS 服务 平台 检测ion
模块 automatically 检测s 平台 and prompts for ffmpeg 安装ation if missing.
Audio 格式化s Opus: Better 质量, smaller file size, suitable for voice calls MP3: Better compatibility, suitable for multimedia playback Notes Requires network connection for gTTS 服务 Temporary files are automatically 清理ed up Ensure 输出 directory has write 权限s