Skip to content

SFX Packs

Saritahh edited this page Oct 25, 2026 · 2 revisions

Yes, the mod is called PlayerSprites, but a Sprite Pack can also play sound effects on the same events that trigger animations. There's no separate "SFX pack" file type. SFX are just part of a regular pack: you add a sounds.json file and some audio files to your pack's folder.

A pack can have sounds and animations, only animations, or only sounds (a pack with just a sounds.json and an empty/no events list works fine).

What you need

  1. Audio files in .ogg or .wav format.
  2. A sounds.json file at the root of your pack's folder, next to spr-pack.json.
MyPack/
├── pack.png
├── spr-pack.json
├── sounds.json
└── sfx/
    ├── jump1.ogg
    ├── jump2.ogg
    ├── land.wav
    └── death.ogg

If the pack has a sounds.json, the user gets an SFX toggle and an SFX button in the pack's settings, to turn sounds on/off and control each one individually, with a play button to preview them.

sounds.json format

The file is an object keyed by gamemode, same as the animations. Inside each gamemode, each entry is keyed by an ID:

{
	"Cube": {
		"NormalJump": "sfx/jump1.ogg",
		"HardLanding": ["sfx/land.wav"]
	},
	"Ship": {
		"ShipBoostStart": { "sounds": ["sfx/boost.ogg"] }
	}
}

Gamemode names are the same as everywhere else: Cube, Ship, Ball, etc. Sounds are per gamemode, so there's no "play this in every gamemode" section. If you want the same sound everywhere, add it to each gamemode.

Entry formats

Each entry can be written in three ways, from simplest to most complete:

1. A single file, as a string:

"NormalJump": "sfx/jump1.ogg"

2. A list of files, as an array:

"NormalJump": ["sfx/jump1.ogg", "sfx/jump2.ogg", "sfx/jump3.ogg"]

Every time the event happens, one of the files is picked at random.

3. The full form, as an object, for when you want control over the behavior:

"Jump-SFX": {
	"sounds": ["sfx/jump1.ogg", "sfx/jump2.ogg"],
	"triggerOn": ["NormalJump", "UFOJump"],
	"ordered": true,
	"resetAfter": 2.0,
	"enabledByDefault": true
}

In the first two forms, the entry's ID is also the event that triggers it. The extra options for control are for the full form, which is honestly the one you should be using.

Keys (full form)

Field Type Required Default Description
sounds string or array of strings Yes The audio file(s) to play. Paths are relative to the pack's root folder.
triggerOn string or array of strings No [<entry ID>] The event(s) that play this sound. Can be a game event, a Mod: event or a shortcut.
ordered boolean No false Only matters with more than one file. Plays the files in order, one per trigger, looping back to the first one, instead of picking at random.
resetAfter number (seconds) No 0 (never) Only with ordered. If this many seconds pass without the sound playing, the order resets, so the next one to play is the first file again.
enabledByDefault boolean No true Whether the sound is on by default. Set it to false for sounds that may be loud or annoying, so users have to manually choose to enable them from the SFX menu.

A few notes:

  • Unlike animations, triggerOn here can be a plain string as well as an array.
  • If triggerOn isn't set, the ID of the entry is used as the trigger. So "NormalJump": "sfx/jump1.ogg" plays when NormalJump happens. If you want a descriptive name instead, set triggerOn.
  • resetAfter can't be negative. Setting it without ordered does nothing, and the mod will log a warning.
  • The ID is what the user sees in the SFX menu, along with "Triggered by: ..." and "In order" if it's ordered.

Ordered sounds are good for combo-like SFX. (They were literally coded for the X4 Zero pack). Say you have three sounds for jumping in a row:

"Cube": {
	"Jumps": {
		"triggerOn": ["JumpPush"],
		"sounds": ["sfx/hop1.ogg", "sfx/hop2.ogg", "sfx/hop3.ogg"],
		"ordered": true,
		"resetAfter": 1.5
	}
}

The first jump plays hop1, the second hop2, the third hop3, and the fourth goes back to hop1. And if you stop jumping for more than 1.5 seconds, the next jump starts again from hop1, even if you were in the middle of the sequence.

The sequence also resets when the player respawns or restarts the level.

Which events can trigger sounds?

  • Every game event from the Available Events list.
  • Shortcuts like Mod:AnyLanding and Mod:BoostOrbs (see Mod Shortcuts & Special Events).
  • Mod:Death, a special event that's only for sounds. It plays when the player dies, regardless of what kind of death animation (or none) the pack uses.
  • Mod:LevelComplete, plays when the player completes the level. This one works for both sounds and animations. Mod:Update, Mod:Idle and the other Mod events for animations can't trigger sounds, since they aren't actual one-time triggers that "happen".

The gamemode that matters is the gamemode the player is in when the event happens. A sound under Cube plays for cube events only.

How are sounds picked?

  • When an event happens, the mod looks for the first pack that is enabled (for the current level type), has SFX turned on, and has at least one enabled sound matching that event for the current gamemode.
  • Sounds are loaded when a level starts, so the first time one plays there should be no delay.
  • Dual mode: if both players are in the same gamemode and the same event hits both, the sound should only play once.

Guidelines & Tips

  • Paths have to be relative to the pack's folder, and they can't go outside it (../ tricks are rejected).
  • Only .ogg and .wav are accepted. Any other extension makes the pack fail to load by design, with a message naming the file.
  • An entry needs at least one file.
  • A file that doesn't exist is just skipped, and logs a warning. If none of an entry's files exist, the whole entry is ignored.
  • sounds.json has to be valid JSON, obviously.
  • Keep sound files short and trimmed. They're loaded into memory when the level starts, so lots of long files will prolly cause lagspikes. Bad.
  • Give each sound a descriptive ID (using triggerOn) if users will be browsing them in the SFX menu. "Jump Sounds" is nicer to read than "JumpPush".

Clone this wiki locally