Skip to content

Song/Sfx

Play sound from Minecraft. Sounds must be registered in Minecraft’s sounds.json.

Syntax

Play song:

song start %namespace:category.name% [%volume% %pitch% [loop=true/false] [fadein %fadeTime%]]

Play sound effect:

sfx start %namespace:category.name% [%volume% %pitch% [loop=true/false] [fadein %fadeTime%]]

Stop song:
song stop %namespace:category.name% [fadeout %fadeTime%]

Stop sound effect:
sfx stop %namespace:category.name% [fadeout %fadeTime%]

Stop all:
song stop all
sfx stop all
sound stop all

INFO

If no namespace is provided, minecraft is used as the default.

Parameters

  • %namespace:category.name% (string): Sound identifier with optional namespace. Defaults to minecraft if omitted.
  • %volume% (float, optional): Volume level (e.g., 0.5 for half volume).
  • %pitch% (float, optional): Pitch level (e.g., 1.2 for higher pitch).
  • loop (boolean, optional): Whether to loop the sound (true or false).
  • fadein %fadeTime% (float, optional): Fade-in duration in seconds when starting sound.
  • fadeout %fadeTime% (float, optional): Fade-out duration in seconds when stopping sound.

Examples

song start narrativecraft:music.intro 0.8 1 true fadein 2
Starts playing the intro music at 80% volume, normal pitch, looping with a 2-second fade-in.

sfx start sfx.page_turn 1 1
Plays the page turn sound effect at full volume and normal pitch.

song stop narrativecraft:music.intro fadeout 3
Stops the intro music, fading out over 3 seconds.

sfx stop sfx.page_turn
Immediately stops the page turn sound effect.

song stop all
Stops all currently playing songs.

sound stop all
Stops all songs and sound effects immediately.