text-to-sfx
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSonilo Text-to-SFX
Sonilo 文本转SFX
Generate a single sound effect from a text description — no video involved. The
prompt IS the input, so describe the action and materials directly. Generation
runs as an async task on the backend; the tool polls internally and hands back
the saved file.
Setup: See the setup-api-key skill.
⚠️ Cost: this tool makes an API call that may incur charges. Only call it when explicitly requested.
Matching sound to footage instead? Use video-to-sfx — it reads the cut and can pin sounds to specific moments, which a text prompt cannot do.
仅根据文本描述生成单个音效——无需视频参与。提示词即为输入内容,请直接描述动作和材质。生成任务在后台以异步方式运行;工具会自动内部轮询,并返回保存好的文件。
设置: 请查看setup-api-key技能。
⚠️ 费用说明: 本工具会调用API,可能产生费用。仅在明确被请求时使用。
想要为视频片段匹配音效? 使用video-to-sfx——它可以读取剪辑内容,并将音效固定到特定时刻,而文本提示词无法做到这一点。
Transport: MCP or CLI
传输方式:MCP 或 CLI
Pick one at the start of the session and stay on it. Do not mix the two inside
a single job, and do not announce the choice.
- Sonilo MCP tools visible in this session (and friends) — use them. This is the preferred path: it needs no shell, and it is the only one that survives a very long generation. If a call fails to authenticate — rather than failing on its inputs — this transport is not usable in this session: go to 2 instead of retrying it.
text_to_sfx - No usable Sonilo MCP tools, but exits 0 — use the CLI commands below. Same API, same account, same credential file. Probe with
sonilo account, notsonilo account: whoami exits 0 even when signed out, so it cannot tell the two states apart.sonilo whoami - Neither — stop and run the setup-api-key skill. Do not call with curl to work around it; both transports handle uploads, polling and retries that a bare request does not.
api.sonilo.com
在会话开始时选择其中一种方式并保持使用,不要在单个任务中混合使用两种方式,也无需告知用户你的选择。
- 当前会话中可见Sonilo MCP工具(及相关工具)——使用这些工具。这是首选方式:无需shell,且是唯一支持长时间生成任务的方式。如果调用因认证失败(而非输入错误),则该传输方式在当前会话中不可用:请直接切换到方式2,不要重试。
text_to_sfx - 无可用的Sonilo MCP工具,但命令返回0——使用下方的CLI命令。API、账户和凭证文件均相同。请用
sonilo account命令验证,不要用sonilo account:即使已登出,whoami仍会返回0,无法区分两种状态。sonilo whoami - 以上两种方式均不可用——停止操作并运行setup-api-key技能。请勿使用curl调用来规避问题;上述两种传输方式均能处理上传、轮询和重试,而裸请求无法做到这些。
api.sonilo.com
Quick Start
快速开始
MCP tool call (recommended)
MCP工具调用(推荐)
text_to_sfx(
prompt="Thunder rumbling in the distance with light rain",
duration=6
)text_to_sfx(
prompt="Thunder rumbling in the distance with light rain",
duration=6
)Python (pip install sonilo
)
pip install soniloPython(pip install sonilo
)
pip install sonilopython
from sonilo import Sonilo
client = Sonilo() # reads SONILO_API_KEY
sfx = client.text_to_sfx.generate(prompt="Thunder rumbling in the distance with light rain", duration=6)
sfx.save("thunder.m4a")python
from 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")JavaScript / TypeScript (npm install sonilo
)
npm install soniloJavaScript / TypeScript(npm install sonilo
)
npm install sonilots
import { SoniloClient } from "sonilo";
const client = new SoniloClient(); // reads SONILO_API_KEY
const sfx = await client.textToSfx.generate({
prompt: "Thunder rumbling in the distance with light rain",
duration: 6,
});ts
import { 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,
});CLI (npm install -g sonilo-cli
or pip install sonilo-cli
)
npm install -g sonilo-clipip install sonilo-cliCLI(npm install -g sonilo-cli
或 pip install sonilo-cli
)
npm install -g sonilo-clipip install sonilo-clibash
sonilo text-to-sfx --prompt "Thunder rumbling in the distance with light rain" --duration 6Always async under the hood — the CLI submits and polls for you. accepts .
--formatwav|mp3|aac|flacbash
sonilo text-to-sfx --prompt "Thunder rumbling in the distance with light rain" --duration 6后台始终采用异步处理——CLI会提交任务并自动轮询。参数支持格式。
--formatwav|mp3|aac|flaccURL (raw REST API, no MCP host)
cURL(原生REST API,无MCP主机)
bash
curl -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"bash
curl -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": "..."} poll GET /v1/tasks/{task_id} until status is succeeded/failed
-> {"task_id": "..."} 轮询GET /v1/tasks/{task_id}直到状态为成功/失败
The endpoint returns `{"task_id": ...}` (HTTP 202) and the result is fetched from `GET /v1/tasks/{task_id}` once `status` is terminal. The MCP tool does this polling for you and returns the saved path directly — you only see the `task_id` if the call times out (see [task-recovery](../task-recovery)).
该端点会返回`{"task_id": ...}`(HTTP 202状态码),当`status`变为终态后,可通过`GET /v1/tasks/{task_id}`获取结果。MCP工具会自动完成轮询,并直接返回保存路径——仅当调用超时(详见[task-recovery](../task-recovery))时,你才会看到`task_id`。Tool
工具
| Tool | Description |
|---|---|
| Generate one SFX clip from a text description only. |
| 工具 | 描述 |
|---|---|
| 仅根据文本描述生成一个SFX片段。 |
Parameters
参数
| Parameter | Type | Default | Notes |
|---|---|---|---|
| string | — | Required. 1–2000 chars. |
| int | — | Required. 1–180 seconds. There is no source to take the length from, so you must set it. |
| string | | |
| string | | Absolute, or relative to the base path. |
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| 字符串 | — | 必填。长度1-2000字符。 |
| 整数 | — | 必填。1-180秒。由于没有来源可获取时长,因此必须手动设置。 |
| 字符串 | | 可选值: |
| 字符串 | | 绝对路径,或相对于基础路径的相对路径。 |
Prompting
提示词撰写
The prompt is the only input — there is no footage to map. Describe the action
and the materials directly, and combine elements: "Heavy rain on a tin roof"
beats "Rain"; "Cinematic braam, horror" or "8-bit retro jump sound" for
stylized cues. The same materials vocabulary and sound-bundle thinking as the
video path applies: references/sfx-prompting.md.
Generate once and iterate on the prompt, not on rerolls — failed runs
auto-refund, but your own retry is a new charge.
提示词是唯一的输入——没有视频片段可映射。请直接描述动作和材质,并组合元素:例如“铁皮屋顶上的大雨”比“雨”的效果更好;如需风格化提示音,可使用“电影式轰鸣,恐怖风格”或“8位复古跳跃音效”。适用于视频路径的材质词汇和音效组合思路同样适用于此:references/sfx-prompting.md。
生成一次后,请通过调整提示词来迭代优化,而非重新生成——失败的任务会自动退款,但自行重试会产生新的费用。
Workflow Tips
工作流程提示
- This is for a single clip with no video context — a UI chime, a whoosh, a foley element you'll layer yourself. If the user has footage, use video-to-sfx instead.
- Duration is required here. Don't guess it — ask if the user hasn't said.
- Don't confuse this with music. For a background score or soundtrack, use text-to-music or video-to-music.
- 本工具适用于无视频上下文的单个片段——比如UI提示音、呼啸声、需自行叠加的拟音元素。如果用户有视频片段,请使用video-to-sfx工具。
- 此处必须指定时长。请勿猜测——如果用户未说明,请询问。
- 请勿与音乐生成混淆。如需生成背景配乐或原声,请使用text-to-music或video-to-music工具。
Recovering a Timed-Out Call
恢复超时调用
Async on the backend already; a long generation can still exceed . If it does, the error carries a — the job keeps running (and is already charged). Call — on the hosted server — later to retrieve the result; see task-recovery.
TIME_OUT_SECONDStask_idget_sfx_task(task_id)get_generation_task(task_id)后台已采用异步处理;但长时间生成任务仍可能超出限制。如果发生超时,错误信息中会包含——任务仍会继续运行(且已产生费用)。稍后可调用(托管服务器上为)来获取结果;详见task-recovery。
TIME_OUT_SECONDStask_idget_sfx_task(task_id)get_generation_task(task_id)Output Files
输出文件
Saved in the requested (//, or for the default), named from the prompt (slugified) or .
audio_format.wav.mp3.flac.m4aaacsfx-<first 8 chars of the task id>文件将以请求的保存(//,默认格式为),文件名由提示词转换而来(简化格式)或为。
audio_format.wav.mp3.flacaac.m4asfx-<任务ID的前8位字符>Error Handling
错误处理
Common errors: invalid key, insufficient balance / trial exhausted, invalid parameters (e.g. duration out of range), rate limit. See the account skill.
401402422429常见错误:密钥无效,余额不足/试用期限已满,参数无效(例如时长超出范围),请求频率超限。详见account技能。
401402422429