<!-- https://bobabanana.com/docs/api/sound-effects/ · Generate sound effects from text with POST /v1/sound-effects. 2 to 20 seconds of ambience, foley or effects as a WAV file, or mixed straight into a video. -->

# Text-to-sound-effects API

**`POST /v1/sound-effects` generates a 2 to 20 second sound effect, ambience or foley clip from a text description and returns a WAV file.** The same feature can be mixed directly into a clip through the `sound_effect` field of [`POST /v1/videos`](https://bobabanana.com/docs/api/videos/).

## Request fields

| Field | Type | Required | Description |
|---|---|---|---|
| `prompt` | string, up to 300 chars | yes | The sound, e.g. "rain on a tin roof with distant thunder" |
| `duration_seconds` | number, 2 to 20 | no | Default 8 |
| `webhook_url`, `metadata`, `name` | | no | As for [images](https://bobabanana.com/docs/api/images/) |

## Example

```bash
curl https://bobabanana.com/api/v1/sound-effects \
  -H "Authorization: Bearer $BOBABANANA_API_KEY" -H "Content-Type: application/json" \
  -d '{"prompt": "busy cafe ambience, cups clinking, soft chatter", "duration_seconds": 12}'
```

When it succeeds, `output.sound_effect.url` is a WAV file.

## Prompt ideas that work well

1. **Ambience:** "forest at dawn, birdsong, light wind in leaves"
2. **Weather:** "heavy rain on a car roof, distant thunder"
3. **Foley:** "footsteps on gravel, slow walking pace"
4. **Machines:** "old film projector whirring"
5. **Impacts:** "a wooden door slams shut in a large hall, echo"
6. **Crowds:** "stadium crowd cheering after a goal"

Describe the source, the space and the intensity. Sound effects are not music or speech generators.

## Frequently asked questions

### What is the maximum length?
20 seconds per job.

### What format is returned?
WAV audio.

### Can I add a sound effect to a video in the same request?
Yes, with `"sound_effect": {"prompt": "...", "duration_seconds": 8}` in `POST /v1/videos`.
