npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@telazer/phaser-audio-helper

v1.0.5

Published

A helper library for Phaser audio management

Downloads

44

Readme

Telazer - Phaser Audio Helper

GitHub

A TypeScript utility for Phaser 3 that simplifies the loading, management, and playback of sound effects and music. With clear separation of keys and file paths, it offers an elegant API for managing game audio in a scalable way.


Installation

npm install @telazer/phaser-audio-helper

Key Features

  • 🔊 Easy loading and playback of SFX and music
  • 🗝️ Distinct key and source mapping
  • 🎚️ Global volume control
  • 🔁 Looping and sequence playback
  • 🎲 Random playback utilities
  • 🎛️ Supports playback rate variation

Getting Started

Import AudioHelper into your Phaser scene. It’s best to load sounds in a boot or preload scene.


Example Scene Integration

import { AudioHelper } from "@telazer/phaser-audio-helper";

export class InitScene extends Phaser.Scene {
  preload() {
    AudioHelper.loadSfx(this, [
      { key: "pop", source: "./assets/sounds/pop.mp3", volume: 1 },
    ]);
  }

  async create() {
    AudioHelper.play("pop");
  }
}

Loading Audio

Load SFX

await AudioHelper.loadSfx(this, [
  { key: "click", source: "./assets/sounds/click.mp3", volume: 0.8 },
  { key: "jump", source: "./assets/sounds/jump.wav", volume: 1.0 },
]);

Load Music

await AudioHelper.loadMusic(this, [
  { key: "bg_music", source: "./assets/music/loop.mp3", volume: 1 },
]);

Playback

Play a Sound

AudioHelper.play("click");

Play Music

AudioHelper.play("bg_music"); // Plays in loop mode

Play on Channel (with transition)

// First call starts track A on channel "bg"
AudioHelper.playOnChannel("bg", "bg_music_A");

// Next call stops previous and starts track B
AudioHelper.playOnChannel("bg", "bg_music_B");

// Use fade transition instead of immediate stop
AudioHelper.playOnChannel("bg", "bg_music_C", { out: "fade" });
// Query current playing key on channel
const current = AudioHelper.isPlayingOnChannel("bg");
// Optionally stop current key on channel with fade
AudioHelper.stopOnChannel("bg", { out: "fade" });

Stop Sound or Music

AudioHelper.stop("click");

Fade Out and Stop (for transitions)

// Fade out over 800ms, then stop and restore configured volume for next play
AudioHelper.fadeOut("bg_music", 800);

Advanced Playback

Set Global Volume

AudioHelper.setSoundVolume(0.5);
AudioHelper.setMusicVolume(0.8);

Play with Randomized Rate

AudioHelper.playRate("jump", 0.1); // ±10% pitch variance

Play a Random Sound

AudioHelper.playRandom(["hit_1", "hit_2", "hit_3"]);

Play in Sequence

AudioHelper.playSequence(["step_1", "step_2", "step_3"], 150, 30); // ±30ms variance

API Reference

| Method | Description | | ----------------------------------------- | ----------------------------------- | | loadSfx(scene, items) | Load sound effects (AudioItem[]) | | loadMusic(scene, items) | Load music tracks (AudioItem[]) | | play(key) | Play a sound or music by key | | playOnChannel(channel, key, options?) | Play by channel with transition | | isPlayingOnChannel(channel) | Get current key if playing | | stopOnChannel(channel, options?) | Stop current channel key (fade opt) | | isPlaying(key) | Check if a key is currently playing | | stop(key) | Stop a sound or music by key | | fadeOut(key, duration?) | Fade volume to 0 and stop | | setSoundVolume(volume) | Set global volume for SFX | | setMusicVolume(volume) | Set global volume for music | | playRate(key, rate) | Play sound with random pitch offset | | playRandom(keys) | Randomly play one from given keys | | playSequence(keys, delay, randomOffset) | Play keys in sequence with timing |


AudioItem Structure

interface AudioItem {
  key: string; // Internal reference key
  source: string; // Path to the audio file
  volume: number; // Individual volume multiplier (0–1)
}

License

MIT License

Copyright (c) 2025 Telazer LLC.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.