Skip to main content
POST
/
audio
/
play
load and play a sound file
curl --request POST \
  --url http://localhost:3917/audio/play \
  --header 'Content-Type: application/json' \
  --data '
{
  "loop": false,
  "max_distance": 50,
  "path": "assets/audio/explosion.wav",
  "position": [
    3,
    0,
    1
  ],
  "volume": 0.8
}
'
{
  "clip": 0,
  "entity_id": 7,
  "ok": true,
  "spatial": true
}

Body

application/json

Load and play a clip: path to the audio file, volume (default 1.0), loop (default false), optional position [x,y,z] (makes it spatial), and max_distance (default 50.0).

The body is of type any.

Response

200 - application/json

Spawned audio-source entity id, the clip handle, and whether it is spatial; returns an error field on a missing path or load failure.