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

com.xmobitea.changx.mini-sound

v1.5.2

Published

Audio playback helpers, mixer-based volume controls, and sound constant generation for XmobiTea Unity Toolkit.

Readme

XmobiTea Sound

Small Unity audio helper for scene-authored projects. It plays music and SFX through AudioSource, routes new sources through assigned AudioMixerGroups, and loads one SoundSettings asset from Resources.

Need-Based Routing

Choose by current need. Open only the smallest file that answers it.

  • AI_USAGE.md: minimal decision guide for playback/volume APIs and normal code generation
  • AI_SETUP.md: setup router
  • AI_SETUP_SOUND_SETTINGS.md: settings asset, mixer setup, startup clips, and generated constants
  • AI_SETUP_SOUND_MANAGER.md: scene manager setup, persistence, and call timing
  • AI_API_REFERENCE.md: exact public signatures, return values, fields, and editor menu names
  • AI_BEHAVIOR.md: lifecycle, mixer, registry, source ownership, and edge-case behavior
  • AGENTS.md: final guardrails for agents working in this package
  • runtime/editor source: only when changing package behavior or when docs conflict with observed behavior

Quick Contract

  • Namespace: XmobiTea.MiniSound
  • Main API: SoundManager : Singleton<SoundManager>
  • Host object: scene GameObject with SoundManager
  • Settings load path: Resources/XmobiTea SoundSettings
  • Default editor-created asset: Assets/Resources/XmobiTea SoundSettings.asset
  • Required mixer params: MasterValue, MusicValue, SoundValue
  • Startup string key: exact AudioClip.name
  • Runtime string key: SoundManager.AddSound(name, clip)
  • Auto-created manager: no
  • Runtime-created settings: no
  • Built-in pause/fade APIs: no

Setup

SoundSettings:

  1. Run XmobiTea Tools/Sound/Open Settings.
  2. Confirm one XmobiTea SoundSettings.asset exists at the root of a Resources folder. The menu creates Assets/Resources/XmobiTea SoundSettings.asset by default.
  3. Assign musicMixerGroup, soundMixerGroup, and masterMixer.
  4. Ensure the assigned mixer exposes MasterValue, MusicValue, and SoundValue.
  5. Add startup string-played clips to audioClips.

SoundManager scene:

  1. Create a boot-scene GameObject named SoundManager.
  2. Add the SoundManager component.
  3. Add XmobiTea.MiniSingleton.DontDestroy only if later scenes need the same sound host.
  4. Keep only one active manager path when using a persistent boot-scene manager.

Call SoundManager APIs from Start() or later unless script execution order guarantees SoundManager.Awake() already ran.

The settings asset existing is not enough; the mixer fields must be assigned before volume/mute and package mixer routing work. Keep only one authoritative settings asset at Resources/XmobiTea SoundSettings so Resources.Load(...) resolves the intended asset.

Detailed setup: AI_SETUP_SOUND_SETTINGS.md and AI_SETUP_SOUND_MANAGER.md.

Basic Usage

using UnityEngine;
using XmobiTea.MiniSound;

public sealed class MenuAudio : MonoBehaviour
{
    [SerializeField] private AudioClip buttonClick;

    private void Start()
    {
        SoundManager.SetVolumeMusicInt(5);
        SoundManager.PlayMusic("MainTheme", true);
    }

    public void PlayButtonClick()
    {
        SoundManager.PlaySound(buttonClick);
    }
}

Prefer direct AudioClip references when available. Use string ids only when the clip is in SoundSettings.audioClips or has been registered with SoundManager.AddSound(name, clip).

Common Calls

SoundManager.PlayMusic("MainTheme", true);
SoundManager.PlaySound("ButtonClick");

SoundManager.StopMusic("MainTheme");
SoundManager.StopAllSound();

SoundManager.SetVolumeMusicInt(5);
SoundManager.SetVolumeSound(-8f);

SoundManager.MuteMusic();
SoundManager.UnmuteMusic();

Runtime-loaded clip:

SoundManager.AddSound("RewardSfx", rewardClip);
SoundManager.PlaySound("RewardSfx");

Target-attached audio:

AudioSource source = SoundManager.Play3DSound(enemy.gameObject, explosionClip);
if (source != null)
{
    source.spatialBlend = 1f;
    source.minDistance = 1f;
    source.maxDistance = 20f;
}

The 3D methods attach or reuse an AudioSource on the target. They do not configure spatial audio settings.

Generated Constants

Run:

XmobiTea Tools/Sound/Generate SoundConstantId.cs

Output:

Assets/XmobiTea-constant/Scripts/SoundConstantId.cs

Generated members are public static readonly string values from SoundSettings.audioClips.

Example: if audioClips contains an AudioClip named MainTheme, generation creates:

public static readonly string MainTheme = "MainTheme";

Then SoundManager.PlayMusic(SoundConstantId.MainTheme, true) is the same lookup as SoundManager.PlayMusic("MainTheme", true).

The field name is normalized with AutoGenerate.GetConstantName(audioClip.name), but the value remains the original clip name. For example, Main Theme becomes SoundConstantId.MainTheme = "Main Theme".

Package Metadata

  • Package name: com.xmobitea.changx.mini-sound
  • Unity version: 2022.3+
  • License: Apache-2.0