技能圖譜SKILLSGROVE
技能圖譜/影片製作/notedit/happy-skills/tts-skill

tts-skill

安裝

$npx skills add https://github.com/notedit/happy-skills --skill tts-skill
$git clone --depth 1 https://github.com/notedit/happy-skills.git /tmp/happy-skills && mkdir -p ~/.claude/skills && cp -r /tmp/happy-skills/skills/utils/tts-skill ~/.claude/skills/tts-skill
請幫我安裝這個 Agent Skill:https://github.com/notedit/happy-skills/tree/9a2d593b620776eb5a8a5847efafb8a32e7c3875/skills/utils/tts-skill ,先閱讀它的 SKILL.md 和指令碼,確認安全後再安裝到我的技能目錄。

簡介

原文描述 · MITMiniMax TTS API - 文本转语音、声音克隆、声音设计
以下 SKILL.md 內容轉載自 notedit/happy-skills(提交 9a2d593),依據 MIT 許可證轉載正文(文字未改動;僅省略檔案頭後設資料、將圖片顯示為連結,超長內容會截斷);版權歸 2025 leeoxiang 所有。許可證:LICENSE。僅展示說明檔案,附帶指令碼請在原倉庫檢視。

MiniMax TTS Skill

这个 Skill 提供 MiniMax TTS API 的完整封装,支持文本转语音、声音克隆和声音设计功能。

快速开始

1. 环境配置

确保已设置环境变量:

export MINIMAX_API_KEY="your-api-key"

详细配置说明见 setup.md

2. 使用 Python 模块

import sys
import os

# 获取 skill 目录路径
skill_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(skill_dir, "assets"))

from minimax_tts import text_to_audio, list_voices, voice_clone, voice_design, play_audio

功能概览

功能 函数 说明
文本转语音 text_to_audio() 将文本转换为语音文件
列出声音 list_voices() 获取可用的声音列表
声音克隆 voice_clone() 基于音频文件克隆声音
声音设计 voice_design() 根据文字描述生成声音
播放音频 play_audio() 播放音频文件

详细文档

快速示例

文本转语音

text_to_audio(
    text="你好,欢迎使用 MiniMax TTS 服务!",
    voice_id="female-shaonv",
    output_path="./hello.mp3"
)

列出可用声音

voices = list_voices(voice_type="system")
for voice in voices:
    print(f"{voice['voice_id']}: {voice['name']}")

声音克隆

voice_clone(
    voice_id="my-custom-voice",
    audio_file="./sample.mp3",
    voice_name="我的声音"
)

声音设计

voice_design(
    prompt="一个温柔的年轻女性声音,带有轻微的南方口音",
    preview_text="你好,这是我的声音"
)

支持的模型

模型 说明
speech-02-hd 高清版本,音质最佳
speech-02-turbo 快速版本,延迟低
speech-01-hd 旧版高清
speech-01-turbo 旧版快速
speech-2.6-hd 2.6 版高清
speech-2.6-turbo 2.6 版快速

常用声音 ID

系统预设声音

  • female-shaonv - 少女音
  • female-yujie - 御姐音
  • female-chengshu - 成熟女声
  • male-qingnian - 青年男声
  • male-chengshu - 成熟男声

更多声音请使用 list_voices() 查询。

檢視許可證全文(MIT)
MIT License

Copyright (c) 2025 leeoxiang

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.