The "patch" command

Some media options can still be changed after playback has started. This is done using the /oa patch command.

This is helpful when creating dynamic effects that need to respond to external factors, such as changing the volume of a sound based on player actions, or adjusting the speed of a track to match gameplay events.

Supported options

The following options can be modified using the patch command

KeyValueDescriptionExample
volumeintThe volume of the media, 0-10085
speedintThe speed of the media, 100 by default, but can be used to speed up or slow down the media. 100 = normal speed, 200 = double speed, 50 = half speed, etc.150
fadeTimeintFade time is the amount of milliseconds it takes to fade in or out. 0 by default, but can be used to create smooth transitions between or to create a fade in/out effect.1500

Basic usage

Command Example
/oa patch <selector> <id> <options>
<>Required
[]Optional

in this case, the 'id' parameter is required to identify which media to patch, and the 'options' parameter is a JSON object containing the properties to be modified.

Examples

  • Change the volume of a specific media for all players:
    Command Example
    /oa patch @a my-song {"volume":60}
    <>Required
    []Optional
  • Change the speed and fade time of a specific media for the nearest player:
    Command Example
    /oa patch @p my-song {"speed":120,"fadeTime":1000}
    <>Required
    []Optional