mcpField
F
fal-audio

fal-audio

github.com/fal-ai-community创意与媒体257295 次安装24 周前更新
代码仓库

关于 fal-audio

使用 fal.ai 模型将文本转换为语音,或将音频转录为文字的技能。提供两类任务的脚本,并可通过搜索工具发现和选择模型。

主要功能

  1. 01文本转语音
  2. 02音频转录
  3. 03可选模型与音色
  4. 04按任务发现模型
  5. 05转录语言选项

适用场景

  1. 01将书面文本制作成旁白
  2. 02转录 URL 中的音频
  3. 03查找语音或音乐任务所需模型

MCP 相关

可使用 search_models MCP 工具查找模型,再通过发现的 modelId 调用 mcp__fal-ai__generate。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/fal-ai-community/skills --skill fal-audio

安装后在 Claude Code 中输入/fal-audio确认已加载。

附带文件scripts/speech-to-text.shscripts/text-to-speech.sh

详细介绍

fal.ai 音频

使用 fal.ai 上最先进的音频模型进行文本转语音和语音转文本。

工作原理

  1. 用户提供文本(用于 TTS)或音频 URL(用于 STT)
  2. 脚本选择合适的模型
  3. 向 fal.ai API 发送请求
  4. 返回音频 URL(TTS)或转录文本(STT)

查找模型

要发现最佳和最新的音频模型,请使用搜索 API:

# Search for text-to-speech models
bash /mnt/skills/user/fal-generate/scripts/search-models.sh --category "text-to-speech"

# Search for speech-to-text models
bash /mnt/skills/user/fal-generate/scripts/search-models.sh --category "speech-to-text"

# Search for music generation models
bash /mnt/skills/user/fal-generate/scripts/search-models.sh --query "music generation"

或者使用 search_models MCP 工具,并输入相关关键词,例如“tts”“speech”“music”。

使用方法

文本转语音
bash /mnt/skills/user/fal-audio/scripts/text-to-speech.sh [options]

参数:

  • --text - 要转换为语音的文本(必需)
  • --model - TTS 模型(默认使用 fal-ai/minimax/speech-2.8-turbo)
  • --voice - 语音 ID 或名称(因模型而异)

示例:

# Basic TTS (fast, good quality)
bash /mnt/skills/user/fal-audio/scripts/text-to-speech.sh \
  --text "Hello, welcome to the future of AI."

# High quality with MiniMax HD
bash /mnt/skills/user/fal-audio/scripts/text-to-speech.sh \
  --text "This is premium quality speech." \
  --model "fal-ai/minimax/speech-2.8-hd"

# Natural voices with ElevenLabs
bash /mnt/skills/user/fal-audio/scripts/text-to-speech.sh \
  --text "Natural sounding voice generation" \
  --model "fal-ai/elevenlabs/tts/eleven-v3"

# Multi-language TTS
bash /mnt/skills/user/fal-audio/scripts/text-to-speech.sh \
  --text "Bonjour, bienvenue dans le futur." \
  --model "fal-ai/chatterbox/text-to-speech/multilingual"
语音转文本
bash /mnt/skills/user/fal-audio/scripts/speech-to-text.sh [options]

参数:

  • --audio-url - 要转录的音频文件 URL(必需)
  • --model - STT 模型(默认使用 fal-ai/whisper)
  • --language - 语言代码(可选,自动检测)

示例:

# Transcribe with Whisper
bash /mnt/skills/user/fal-audio/scripts/speech-to-text.sh \
  --audio-url "https://example.com/audio.mp3"

# Transcribe with speaker diarization
bash /mnt/skills/user/fal-audio/scripts/speech-to-text.sh \
  --audio-url "https://example.com/meeting.mp3" \
  --model "fal-ai/elevenlabs/speech-to-text/scribe-v2"

# Transcribe specific language
bash /mnt/skills/user/fal-audio/scripts/speech-to-text.sh \
  --audio-url "https://example.com/spanish.mp3" \
  --language "es"

MCP 工具替代方案

使用 search_models MCP 工具或 search-models.sh 查找当前最合适的模型,然后调用 mcp__fal-ai__generate,并传入找到的 modelId。

输出

文本转语音输出
Generating speech...
Model: fal-ai/minimax/speech-2.8-turbo

Speech generated!

Audio URL: https://v3.fal.media/files/abc123/speech.mp3
Duration: 5.2s
语音转文本输出
Transcribing audio...
Model: fal-ai/whisper

Transcription complete!

Text: "Hello, this is the transcribed text from the audio file."
Duration: 12.5s
Language: en

向用户展示结果

对于 TTS:
Here's the generated speech:

[Download audio](https://v3.fal.media/files/.../speech.mp3)

• Duration: 5.2s | Model: Maya TTS
对于 STT:
Here's the transcription:

"Hello, this is the transcribed text from the audio file."

• Duration: 12.5s | Language: English

模型选择提示

  • 文本转语音:搜索 text-to-speech 类别。权衡质量与速度。
  • 文本转音乐:搜索 music generation。有些模型专门用于人声,另一些则专注于纯音乐。
  • 语音转文本:搜索 speech-to-text 类别。考虑是否需要说话人分离或多语言支持。

故障排除

音频为空
Error: Generated audio is empty

Check that your text is not empty and contains valid content.
不支持的音频格式
Error: Audio format not supported

Supported formats: MP3, WAV, M4A, FLAC, OGG
Convert your audio to a supported format.
语言检测失败
Warning: Could not detect language, defaulting to English

Specify the language explicitly with --language option.

评论

支持 Markdown