技能圖譜SKILLSGROVE
技能圖譜/影片製作/jholhewres/devclaw-skills/audio-tts

audio-tts

安裝

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

簡介

原文描述 · MITText-to-Speech and audio tools — convert text to speech, manipulate audio
以下 SKILL.md 內容轉載自 jholhewres/devclaw-skills(提交 0177c36),依據 MIT 許可證轉載正文(文字未改動;僅省略檔案頭後設資料、將圖片顯示為連結,超長內容會截斷);版權歸 2026 DevClaw 所有。許可證:LICENSE。僅展示說明檔案,附帶指令碼請在原倉庫檢視。

Audio TTS

Convert text to speech and manipulate audio files.

Setup

API keys (store in vault, never use export):

  • OpenAI: vault_save openai_api_key "sk-xxx"
  • ElevenLabs: vault_save elevenlabs_api_key "xxx"
  • Google TTS: vault_save google_tts_key "xxx"
  • Check: vault_get openai_api_key — keys auto-inject as uppercase env vars (e.g. OPENAI_API_KEY)

CLI tools (for audio manipulation and free TTS):

  • macOS: brew install ffmpeg (for Option 5 and audio manipulation); espeak via brew install espeak
  • Ubuntu: sudo apt install ffmpeg espeak-ng

Option 1: OpenAI TTS (Recommended)

# Text to speech
curl -s -X POST "https://api.openai.com/v1/audio/speech" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tts-1",
    "input": "Hello, this is a text to speech example.",
    "voice": "alloy"
  }' -o output.mp3

# Voices: alloy, echo, fable, onyx, nova, shimmer
# Models: tts-1 (faster), tts-1-hd (higher quality)

Option 2: ElevenLabs TTS

# Setup
export ELEVENLABS_API_KEY="xxx"

# Text to speech
curl -s -X POST "https://api.elevenlabs.io/v1/text-to-speech/VOICE_ID" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from DevClaw!",
    "model_id": "eleven_monolingual_v1",
    "voice_settings": {"stability": 0.5, "similarity_boost": 0.5}
  }' -o output.mp3

# List voices
curl -s "https://api.elevenlabs.io/v1/voices" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" | jq '.voices[]'

Option 3: Google Cloud TTS

# Synthesize speech
curl -s -X POST "https://texttospeech.googleapis.com/v1/text:synthesize?key=$GOOGLE_TTS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {"text": "Hello world"},
    "voice": {"languageCode": "en-US", "name": "en-US-Standard-A"},
    "audioConfig": {"audioEncoding": "MP3"}
  }' | jq -r '.audioContent' | base64 -d > output.mp3

Option 4: Amazon Polly

# Requires AWS CLI setup
aws polly synthesize-speech \
  --output-format mp3 \
  --voice-id Joanna \
  --text "Hello from DevClaw" \
  output.mp3

Option 5: Free TTS (say command)

# macOS built-in
say "Hello world" -o output.aiff

# Convert to MP3
ffmpeg -i output.aiff output.mp3

# Linux (espeak)
espeak "Hello world" -w output.wav

Audio Manipulation (ffmpeg)

# Change speed
ffmpeg -i input.mp3 -filter:a "atempo=1.5" output.mp3

# Change volume
ffmpeg -i input.mp3 -filter:a "volume=2.0" output.mp3

# Trim audio
ffmpeg -i input.mp3 -ss 00:00:10 -t 30 output.mp3

# Convert format
ffmpeg -i input.wav -c:a libmp3lame -q:a 2 output.mp3

# Merge audio files
ffmpeg -i "concat:file1.mp3|file2.mp3" -c copy output.mp3

# Extract audio from video
ffmpeg -i video.mp4 -vn -c:a libmp3lame audio.mp3

Speech-to-Text (Transcription)

# OpenAI Whisper
curl -s -X POST "https://api.openai.com/v1/audio/transcriptions" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -F "file=@audio.mp3" \
  -F "model=whisper-1" | jq '.text'

# With timestamp
curl -s -X POST "https://api.openai.com/v1/audio/transcriptions" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -F "file=@audio.mp3" \
  -F "model=whisper-1" \
  -F "response_format=verbose_json" | jq '.segments'

Tips

  • OpenAI TTS: Good quality, simple API
  • ElevenLabs: Best quality, many voice options
  • Use tts-1-hd for production quality
  • Audio formats: MP3, WAV, OGG, AAC supported
  • For long texts, split into chunks

Triggers

tts, text to speech, speech synthesis, voice, audio, convert text to speech, read text aloud

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

Copyright (c) 2026 DevClaw

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.