# Hosted music and sound effects

Create music or a sound effect from a prompt with the app's own generators, paid with StillMade credits.

Use `runtime: "capability"` with `operation: "audio.music"` or
`operation: "audio.sfx"` to create music or a sound effect with the app's own
generators: ACE-Step music and StillMade sound effects, the same ones the
Editor uses. The person running the Block pays with StillMade credits at the
app's prices (music by the minute, one flat price per sound effect). Block code
never sees keys, endpoints or payment.

The manifest declares one `text`, `script` or `brief` input, one `audio`
output, and `permissions.capabilities: ["audio.music"]` (or `["audio.sfx"]`):

```json
{"schemaVersion":1,"operation":"audio.music","prompt":{"$input":"brief"},"output":"music","settings":{"durationSec":30}}
```

`settings.durationSec` is optional and only suggests a length. Music runs 5 to
240 whole seconds; sound effects run 0.5 to 22 seconds in tenths. The person
running the Block can change the length in the dialog, and the quote shows the
price for that length before anything is generated.

The output is a measured MP3 or WAV reference:

```json
{"kind":"audio","assetId":"audio:run:0","versionId":"<sha256>","url":"/api/media/owner/capaud3-....mp3","mimeType":"audio/mpeg","duration":30.02,"bytes":481254,"sampleRate":44100,"channels":2}
```

Fixture expectations use `format` `any`, `mp3` or `wav` with duration and byte
bounds (up to 1,800 seconds and 128 MiB):

```json
{"music":{"kind":"audio","format":"any","minDuration":1,"maxDuration":241,"minBytes":45,"maxBytes":134217728}}
```

The offline SDK includes `packages/block-sdk/audio-generation-example.js`,
exporting `audioMusic` and `audioSfx`. Review, listening and acceptance follow
the same flow as [hosted speech](/docs/build/hosted-speech#review-listen-and-accept): **Review cost**
never generates, each fixture and the sample is quoted and charged once, and a
provider refusal before generation is refunded.
