Repository navigation
Description
Summary
Add a TextToSFX tool that turns a text prompt into a short sound effect or ambience clip, the way TextToSpeech turns text into a voice. The desktop's video-editing skill already places any WAV on an audio lane and the export mixes it, so sound effects such as a whoosh, a click, a riser or room tone are the missing piece for agent-made videos. TextToSpeech cannot cover this: speech models read the word "whoosh" aloud.
The sound is generated behind the gateway's POST /v1/audio/sfx, shipped in gateway v0.54.0 (inference-gateway/inference-gateway#671), and reached through the SDK's CreateSFX(ctx, provider, CreateSFXRequest) ([]byte, error) from sdk v1.38.0. First model elevenlabs/eleven_text_to_sound_v2. The CLI holds no provider key; ELEVENLABS_API_KEY lives with the gateway. Depends on #1260 (SDK bump to v1.38.0). No longer blocked on the gateway.
Shape
- Tool name
TextToSFX, gated bytext_to_sfx.enabled(default false, tool hidden when false), mirroringtext_to_speech. - Inputs:
prompt(text),seconds(0.5-30, optional, maps toduration_seconds; omitted lets the model pick),loop(optional bool),output_path(bare file name, same rule asTextToSpeech). The request always setsresponse_format: wav. - Output:
path,prompt,duration_seconds(viaaudio.WAVDurationSeconds), the same shapeTextToSpeechreports so a skill handles both alike. - Config, top-level
text_to_sfx:next totext_to_speech:inconfig/config.go:enabled,model(gatewayprovider/modelid, defaultelevenlabs/eleven_text_to_sound_v2),output_dir(default~/.infer/tmp/sfx),require_approval(tri-state*bool, added to the tool-name switch).INFER_TEXT_TO_SFX_*overrides come free from the reflective env loader. - Domain: a
SoundEffectServiceport ininternal/agent/domain/media.gonext toSpeechService, error-only signature likeSynthesize(the file on disk is the result). Gateway implementationinternal/agent/infrastructure/sfx_service.gofollowingspeech_service.go(provider/modelsplit viastrings.Cut, empty-payload guard, write file). Wired ininternal/container/container.goandinternal/agent/tools/registry.go; counterfeiter line added tomocks:generate. - The
output_pathchecks (resolveOutputPathintext_to_speech.go: reject absolute paths, separators and.., join under the output dir) are hoisted into one shared helper ininternal/agent/toolsandTextToSpeechswitches to it. Not copied.
Follow-up in inference-gateway/desktop once the tool exists: extend .agents/skills/video-editing/SKILL.md so the agent may add an sfx audio track and allow TextToSFX in its tool list (inference-gateway/desktop#251).
Acceptance Criteria
-
TextToSFXis registered withprompt,seconds,loopandoutput_pathinputs and is hidden unlesstext_to_sfx.enabledis true. - The tool calls the gateway through the
SoundEffectServiceport; the infrastructure implementation usessdk.Client.CreateSFXand writes a WAV intotext_to_sfx.output_dir. -
output_pathrejects directories, absolute paths and..through the helper shared withTextToSpeech. - A provider error, or a gateway without the endpoint, produces a one-line error naming the model; a failed call leaves no partial file.
- Unit tests cover argument validation and the result shape with a fake service (
text_to_speech_test.gopattern); an infrastructure test usessdkmocks.FakeClient(speech_service_test.gopattern). - One integration test in
tests/integrationruns the tool against the mock gateway (image_generation_test.gopattern, model entry intests/integration/scenarios.yaml). If the mock gateway does not serve/v1/audio/sfx, the PR says so and files the gap against inference-gateway/tokenless. -
docs/tools-reference.md,docs/configuration-reference.mdanddocs/directory-structure.md(tmp table) list the tool andtext_to_sfx.enabled,model,output_dir,require_approval; a[DOCS]ticket is filed against inference-gateway/docs with the PR.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]feat(tools): GenerateSound tool for text-to-sound-effect generation[/-][+][FEATURE] GenerateSound tool for text-to-sound-effect generation[/+][-][FEATURE] GenerateSound tool for text-to-sound-effect generation[/-][+][FEATURE] TextToSFX tool for text-to-sound-effect generation[/+]chore(deps): bump inference-gateway/sdk to v1.38.0 (#1262)
feat(tools): add text-to-music generation tool (#1265)
edenreich commentedon Sep 22, 2026
@infer Can you work on this? use /ponytail:ponytail /go /go-concurrency /domain-driven-design
inference-gateway-maintainer commentedon Sep 22, 2026
Model:
ollama_cloud/glm-5.3-flash· View JobTodos
Pull Request
#1268
✅ Infer Result: Success
All verified. Let me finalize the todos:
Done. All work is committed, pushed, and the PR is ready for review.
Summary
Implemented the
TextToSFXtool from issue #1227: a text-to-sound-effect tool (whoosh, click, riser, room tone) through the gateway's SFX API (POST /v1/audio/sfx, SDK v1.38.0CreateSFX), mirroring the mergedTextToMusicpattern. Both prerequisites (PR #1262 SDK bump, PR #1265 music tool) were already merged, so I built directly on main's patterns - including reusing theresolveMediaOutputPathhelper that PR #1265 had already hoisted intotext_to_speech.go(nothing was copied).PR: #1268 (ready for review, branch
fix/issue-1227)What changed
SoundEffectServiceport ininternal/agent/domain/media.gonext toSpeechService/MusicService-Generate(ctx, prompt, outPath, seconds *float32, loop *bool) error.internal/agent/infrastructure/sfx_service.gofollowingspeech_service.go-provider/modelsplit viastrings.Cut,sdk.Client.CreateSFXwithresponse_format: wav, empty-payload guard, writes the file, errors name the model.text_to_sfx:(enabled,modeldefaultelevenlabs/eleven_text_to_sound_v2,output_dirdefault~/.infer/tmp/sfx, tri-staterequire_approval), provider/model validation,IsApprovalRequiredcase,NeedsGatewayAudio()extended (enabling SFX auto-starts the gateway withAUDIO_ENABLED=true);INFER_TEXT_TO_SFX_*env overrides come free.internal/agent/tools/text_to_sfx.go- inputsprompt/seconds(0.5-30)/loop/output_path; result reportspath,prompt,duration_secondsviaaudio.WAVDurationSeconds, the same shape asTextToSpeech. Registered inregistry.go(hidden unless enabled) and wired in the container; counterfeiterFakeSoundEffectServiceadded tomocks:generate.sdkmocks.FakeClient, and one integration test against the mock gateway. Full suite passes.docs/tools-reference.md,docs/configuration-reference.md,docs/directory-structure.md(tmp table).Follow-ups filed
/v1/audio/sfx, so the integration test pins the failure behavior (like the merged music test) until the endpoint lands.[DOCS]ticket for the user-facing docs.sfxaudio track) remains tracked in [FEATURE] Animated card overlays rendered from HTML (HyperFrames-style) desktop#251, as the issue notes.Board: issue #1227 moved to QA on the Roadmap 2026 board. No release actions taken - the Conventional Commits (
feat(tools):/test(tools):) let semantic-release handle versioning after merge.Model:
ollama_cloud/glm-5.3-flash· Exit Code:0· Duration: 20m 40sTokens: 12,077,041 in · 53,072 out · 12,130,113 total (96 requests)
Tool calls: 133 total · 100% success rate
Traces
Stats
Triggered by edenreich · Infer Action · OSS
inference-gateway-releaser commentedon Sep 23, 2026
🎉 This issue has been resolved in version 0.206.0 🎉
The release is available on:
Your semantic-release bot 📦🚀