← 返回
效率工具 中文

Pywayne Tts

Text-to-speech conversion tool. Use when converting text to speech audio files (opus or mp3 format). Supports macOS native 'say' command and Google TTS (gTTS...
文字转语音工具,用于将文本转换为语音音频文件(支持opus或mp3格式),支持macOS原生‘say’命令和Google TTS(gTTS...
wangyendt
效率工具 clawhub v0.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 762
下载
💾 24
安装
1
版本
#latest

概述

Pywayne TTS

Text-to-speech (TTS) tool that converts text to audio files (opus or mp3 format).

Functions

text_to_speech_output_opus - Convert text to Opus format

from pywayne.tts import text_to_speech_output_opus

# Output: test.opus
text_to_speech_output_opus("你好,世界", "test.opus")

Parameters:

  • text - Text to convert
  • opus_filename - Output .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 platforms, uses Google TTS (gTTS) service
  • Uses ffmpeg to convert audio to opus format (16kHz, mono channel)
  • Automatically cleans up temporary files

text_to_speech_output_mp3 - Convert text to MP3 format

from pywayne.tts import text_to_speech_output_mp3

# Output: test.mp3
text_to_speech_output_mp3("你好,世界", "test.mp3")

Parameters:

  • text - Text to convert
  • mp3_filename - Output .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 platforms, uses Google TTS (gTTS) service
  • Uses ffmpeg to convert audio to mp3 format
  • Automatically cleans up temporary files

Quick Start

# Convert text to Opus format (default: macOS uses 'say')
text_to_speech_output_opus "你好,世界" "test.opus"

# Convert text to MP3 format
text_to_speech_output_mp3 "你好,世界" "test.mp3"

# Force use gTTS instead of macOS 'say'
text_to_speech_output_mp3 "你好,世界" "test.mp3" use_say=False

Requirements

  • ffmpeg: Required for audio conversion
  • macOS: brew install ffmpeg
  • Windows: Download from https://ffmpeg.org and add to PATH
  • Linux: sudo apt install ffmpeg or package manager
  • gtts: Python library for Google TTS service

Platform Detection

Module automatically detects platform and prompts for ffmpeg installation if missing.

Audio Formats

  • Opus: Better quality, smaller file size, suitable for voice calls
  • MP3: Better compatibility, suitable for multimedia playback

Notes

  • Requires network connection for gTTS service
  • Temporary files are automatically cleaned up
  • Ensure output directory has write permissions

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-03-29 10:03 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

productivity

Nano Pdf

steipete
使用nano-pdf CLI通过自然语言指令编辑PDF
★ 275 📥 114,730
content-creation

Pywayne Lark Bot

wangyendt
飞书/Lark 机器人 API 封装,提供完整的飞书机器人交互功能。适用于需要发送文本、图片、音频、文件、帖子、交互式、分享等各类消息的场景。
★ 0 📥 1,256
productivity

Word / DOCX

ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 438 📥 147,198