Audio Playback

The 'patch' command

How to use the patch command to update the audio client.

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<> required[] optional

/oa patch <selector> <id> <options>

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<> required[] optional

    /oa patch @a my-song {"volume":60}

  • Change the speed and fade time of a specific media for the nearest player:
    Command<> required[] optional

    /oa patch @p my-song {"speed":120,"fadeTime":1000}