Melonjs audio
Helps you sound and music in melonJS, loading audio, playing effects, background tracks, audio sprites, volume and muting, spatial audio.
In detail
Use this skill for sound and music in melonJS — loading audio, playing effects, background tracks, audio sprites, volume and muting, spatial audio, procedural tone/noise generation, and effects such as reverb or a compressor on the whole mix. Covers the mandatory audio.init format list, the directory-not-file src convention, playTrack versus play, the fixed listener and pixel-scale distances of positional sound, and browser autoplay unlocking. Triggers on: audio, sound, audio.init, audio.play, playTrack, stopTrack, audio.load, sfx, music, volume, mute, fade, rate, pitch, sprite audio, stereo, panner, position, listener, refDistance, reverb, echo, delay, compressor, distortion, filter, audio effect, audio.tone, audio.noise, getAudioContext, getMasterGain, hasAudio, hasFormat, autoplay, no sound, sound stopped working, context suspended, silent after idle, clips silent but tones play.
Safety check
- Not rated by Claude yet. We only sell skills Claude has read and rated 7 out of 10 or higher, so this one is a free link to its author.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: melonjs-audio
description: "Use this skill for sound and music in melonJS — loading audio, playing effects, background tracks, audio sprites, volume and muting, spatial audio, procedural tone/noise generation, and effects such as reverb or a compressor on the whole mix. Covers the mandatory audio.init format list, the directory-not-file src convention, playTrack versus play, the fixed listener and pixel-scale distances of positional sound, and browser autoplay unlocking. Triggers on: audio, sound, audio.init, audio.play, playTrack, stopTrack, audio.load, sfx, music, volume, mute, fade, rate, pitch, sprite audio, stereo, panner, position, listener, refDistance, reverb, echo, delay, compressor, distortion, filter, audio effect, audio.tone, audio.noise, getAudioContext, getMasterGain, hasAudio, hasFormat, autoplay, no sound, sound stopped working, context suspended, silent after idle, clips silent but tones play."
license: MIT
---
# Audio
## Two setup rules
```js
import { audio, loader } from "melonjs";
audio.init("mp3,ogg"); // 1. BEFORE preloading any audio
await loader.preload([
{ name: "cling", type: "audio", src: "data/sfx/" }, // 2. a PREFIX, not a file
]);
```
1. **`audio.init(format)` must run before any audio asset is preloaded**, and
lists the formats you actually ship. Preloading first fails the preload:
`await loader.preload(...)` rejects with the loader's `Failed loading
resource <src>`, which hides the real reason, `target audio extension(s)
should be set through me.audio.init() before calling the preloader.`
(thrown as it is by `audio.load()` called directly). It returns `false`
when no audio backend is available, so it is worth checking. The format
list defaults to `"mp3"`.
2. **`src` is a prefix, not a file.** The loader appends the asset `name` plus
each configured extension and uses the first that loads — so
`data/sfx/` + `cling` + `mp3` → `data/sfx/cling.mp3`. Passing a full filename
gives you a 404. A `data:audio/...` URL is the one exception: it is used
verbatim, prefix and extension skipped.
`audio.hasAudio()` says whether the browser can play audio at all, and
`audio.hasFormat("ogg")` whether it can play one codec — useful for choosing
the `init` list or hiding a sound toggle on a device with no audio.
Order matters — melonJS tries the listed formats left to right, so put the
preferred one first. Two formats (`"webm,mp3"` or `"mp3,ogg"`) is the usual
...From melonjs's repository, MIT licence.
Related skills
-
Checked
Flutter sound effect filters
Applies flutter_soloud echo, reverb, EQ and pitch filters correctly, so your Flutter app audio sounds right.
8/101 credit -
Checked
Flutter positional audio
Adds positional 3D sound to Flutter apps with flutter_soloud, so effects shift and fade as things move around.
8/101 credit -
Checked
Flutter SoLoud audio
Explains how to use the flutter_soloud audio plugin correctly and which feature fits each game sound problem.
7/101 credit -
Checked
Godot game audio
Wires up sound effects, music and volume sliders in Godot and fixes sounds that go silent or will not loop.
8/101 credit -
Checked
Podcast show notes
Turns a podcast transcript into search friendly show notes with timestamps, key quotes and social captions.
7/101 credit -
Checked
Cut to the beat
Plans video edits that cut to the beat, with transitions, speed ramps and pacing for your editor or Remotion.
8/101 credit