sound-effects by elevenlabs/skills
npx skills add https://github.com/elevenlabs/skills --skill sound-effects根据文本描述生成音效——支持循环播放、自定义时长和提示词遵循度控制。
设置: 请参阅安装指南。对于 JavaScript,请仅使用
@elevenlabs/*包。
from elevenlabs import ElevenLabs
client = ElevenLabs()
audio = client.text_to_sound_effects.convert(
text="Thunder rumbling in the distance with light rain",
)
with open("thunder.mp3", "wb") as f:
for chunk in audio:
f.write(chunk)
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
import { createWriteStream } from "fs";
const client = new ElevenLabsClient();
const audio = await client.textToSoundEffects.convert({
text: "Thunder rumbling in the distance with light rain",
});
audio.pipe(createWriteStream("thunder.mp3"));
curl -X POST "https://api.elevenlabs.io/v1/sound-generation" \
-H "xi-api-key: $ELEVENLABS_API_KEY" -H "Content-Type: application/json" \
-d '{"text": "Thunder rumbling in the distance with light rain"}' \
--output thunder.mp3
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
text | string (必填) | — | 期望音效的描述 |
model_id | string | eleven_text_to_sound_v2 | 使用的模型 |
duration_seconds | number | null | null (自动) |
prompt_influence | number | null | 0.3 |
loop | boolean | false | 生成无缝循环音效 (仅限 v2 模型) |
# 循环环境音,10 秒
audio = client.text_to_sound_effects.convert(
text="Gentle forest ambiance with birds chirping",
duration_seconds=10.0,
prompt_influence=0.5,
loop=True,
)
# 短 UI 音效,高提示词遵循度
audio = client.text_to_sound_effects.convert(
text="Soft notification chime",
duration_seconds=1.0,
prompt_influence=0.8,
)
通过查询参数 (cURL) 或 SDK 参数传递 output_format:
| 格式 | 描述 |
|---|---|
mp3_44100_128 | MP3 44.1kHz 128kbps (默认) |
pcm_44100 | 原始未压缩 CD 音质 |
opus_48000_128 | Opus 48kHz 128kbps — 高效压缩 |
ulaw_8000 | μ-law 8kHz — 电话音质 |
完整列表:mp3_22050_32, mp3_24000_48, mp3_44100_32, mp3_44100_64, mp3_44100_96, mp3_44100_128, mp3_44100_192, pcm_8000, pcm_16000, pcm_22050, pcm_24000, pcm_32000, pcm_44100, pcm_48000, ulaw_8000, alaw_8000, opus_48000_32, opus_48000_64, opus_48000_96, opus_48000_128, opus_48000_192.
try:
audio = client.text_to_sound_effects.convert(text="Explosion")
except Exception as e:
print(f"API error: {e}")
常见错误:
每周安装量
1.3K
代码仓库
GitHub 星标数
143
首次出现
2026年1月29日
安全审计
安装于
gemini-cli962
codex962
opencode944
claude-code927
github-copilot847
kimi-cli793
Generate sound effects from text descriptions — supports looping, custom duration, and prompt adherence control.
Setup: See Installation Guide. For JavaScript, use
@elevenlabs/*packages only.
from elevenlabs import ElevenLabs
client = ElevenLabs()
audio = client.text_to_sound_effects.convert(
text="Thunder rumbling in the distance with light rain",
)
with open("thunder.mp3", "wb") as f:
for chunk in audio:
f.write(chunk)
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
import { createWriteStream } from "fs";
const client = new ElevenLabsClient();
const audio = await client.textToSoundEffects.convert({
text: "Thunder rumbling in the distance with light rain",
});
audio.pipe(createWriteStream("thunder.mp3"));
curl -X POST "https://api.elevenlabs.io/v1/sound-generation" \
-H "xi-api-key: $ELEVENLABS_API_KEY" -H "Content-Type: application/json" \
-d '{"text": "Thunder rumbling in the distance with light rain"}' \
--output thunder.mp3
| Parameter | Type | Default | Description |
|---|---|---|---|
text | string (required) | — | Description of the desired sound effect |
model_id | string | eleven_text_to_sound_v2 | Model to use |
duration_seconds | number | null | null (auto) |
prompt_influence | number |
# Looping ambient sound, 10 seconds
audio = client.text_to_sound_effects.convert(
text="Gentle forest ambiance with birds chirping",
duration_seconds=10.0,
prompt_influence=0.5,
loop=True,
)
# Short UI sound, high prompt adherence
audio = client.text_to_sound_effects.convert(
text="Soft notification chime",
duration_seconds=1.0,
prompt_influence=0.8,
)
Pass output_format as a query parameter (cURL) or SDK parameter:
| Format | Description |
|---|---|
mp3_44100_128 | MP3 44.1kHz 128kbps (default) |
pcm_44100 | Raw uncompressed CD quality |
opus_48000_128 | Opus 48kHz 128kbps — efficient compressed |
ulaw_8000 | μ-law 8kHz — telephony |
Full list: mp3_22050_32, mp3_24000_48, mp3_44100_32, mp3_44100_64, mp3_44100_96, mp3_44100_128, mp3_44100_192, pcm_8000, pcm_16000, pcm_22050, pcm_24000, pcm_32000, , , , , , , , , .
try:
audio = client.text_to_sound_effects.convert(text="Explosion")
except Exception as e:
print(f"API error: {e}")
Common errors:
Weekly Installs
1.3K
Repository
GitHub Stars
143
First Seen
Jan 29, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli962
codex962
opencode944
claude-code927
github-copilot847
kimi-cli793
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
| null |
| 0.3 |
loop | boolean | false | Generate a seamlessly looping sound (v2 model only) |
pcm_44100pcm_48000ulaw_8000alaw_8000opus_48000_32opus_48000_64opus_48000_96opus_48000_128opus_48000_192