Loading...
Loading...
当没有匹配的视频时,使用Sonilo根据文本描述生成音效——比如UI提示音、呼啸声、撞击声、环境音、风格化提示音等。适用于用户用文字描述想要的音效并提供时长的场景。如果需要为视频片段匹配音效,请使用video-to-sfx技能;如果需要生成音乐,请使用text-to-music技能。
npx skill4agent add sonilo-ai/skills text-to-sfx设置: 请查看setup-api-key技能。
⚠️ 费用说明: 本工具会调用API,可能产生费用。仅在明确被请求时使用。
想要为视频片段匹配音效? 使用video-to-sfx——它可以读取剪辑内容,并将音效固定到特定时刻,而文本提示词无法做到这一点。
text_to_sfxsonilo accountsonilo accountsonilo whoamiapi.sonilo.comtext_to_sfx(
prompt="Thunder rumbling in the distance with light rain",
duration=6
)pip install sonilofrom sonilo import Sonilo
client = Sonilo() # 读取SONILO_API_KEY
sfx = client.text_to_sfx.generate(prompt="Thunder rumbling in the distance with light rain", duration=6)
sfx.save("thunder.m4a")npm install soniloimport { SoniloClient } from "sonilo";
const client = new SoniloClient(); // 读取SONILO_API_KEY
const sfx = await client.textToSfx.generate({
prompt: "Thunder rumbling in the distance with light rain",
duration: 6,
});npm install -g sonilo-clipip install sonilo-clisonilo text-to-sfx --prompt "Thunder rumbling in the distance with light rain" --duration 6--formatwav|mp3|aac|flaccurl -X POST "https://api.sonilo.com/v1/text-to-sfx" \
-H "Authorization: Bearer $SONILO_API_KEY" \
--data-urlencode "prompt=Thunder rumbling in the distance with light rain" \
--data-urlencode "duration=6"
# -> {"task_id": "..."} 轮询GET /v1/tasks/{task_id}直到状态为成功/失败{"task_id": ...}statusGET /v1/tasks/{task_id}task_id| 工具 | 描述 |
|---|---|
| 仅根据文本描述生成一个SFX片段。 |
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| 字符串 | — | 必填。长度1-2000字符。 |
| 整数 | — | 必填。1-180秒。由于没有来源可获取时长,因此必须手动设置。 |
| 字符串 | | 可选值: |
| 字符串 | | 绝对路径,或相对于基础路径的相对路径。 |
TIME_OUT_SECONDStask_idget_sfx_task(task_id)get_generation_task(task_id)audio_format.wav.mp3.flacaac.m4asfx-<任务ID的前8位字符>401402422429