SoundUtils - Make Sound Management Less of a Headache

SoundUtils - A comprehensive and easy set of Sound Utility Tools!


Introduction - What is SoundUtils?

SoundUtils is a powerful utility-type sound management library that simplifies audio handling in your code. It provides clean and intuitive APIs for sound creation, profile-based configuration, batch preloading, and advanced playback control.


Features

  • Sound Profiles - Create reusable sound configurations
  • Batch Preloading - Load multiple sounds efficiently with progress tracking
  • Flexible Creation - Create sounds from configs, profiles, or combinations
  • Advanced Playback - Sync, async, and callback-based playback methods
  • Auto-cleanup - Optional automatic sound destruction after playback
  • Type-Annotation Support - Full type definitions for better dev experience

Basic Usage

The usage of SoundUtils varies based on what you want, but it follows a utility module pattern.
From basic sound creation, to reusable profiles and preloading, *SoundUtils has it.

Sound Creation:

local SoundUtils = require(path.to.SoundUtils)

-- Creating a simple sound!
local sound = SoundUtils.create({
    SoundId = "rbxassetid://12345678",
    Volume = 0.8,
    Parent = workspace
})

-- Play it
SoundUtils.play(sound)

Using Sound Profiles:

-- Create a profile for UI sounds
local uiProfile = SoundUtils.newProfile({
    Name = "UIProfile",
    Volume = 0.6,
    PlaybackSpeed = 1.2,
    RollOffMode = Enum.RollOffMode.InverseTapered
})

-- Create sounds using the profile
local clickSound = SoundUtils.createFromProfile("UIProfile", {
    SoundId = "rbxassetid://12345678",
    Name = "ClickSound"
})

Extremely helpful for a modular design!

Batch Preloading:

-- Create a preloader
local preloader = SoundUtils.newPreloader()

-- Add sounds to preload
preloader:Add("rbxassetid://12345678", "BackgroundMusic", "MusicProfile")
preloader:Add("rbxassetid://87654321", "JumpSound", "SFXProfile")

-- Or you can more cleanly use :AddBatch
preloader:AddBatch({
	BackgroundMusic = {
		SoundId = "rbxassetid://12345678",
		Profile = "MusicProfile"
	},
	JumpSound = {
		SoundId = "rbxassetid://87654321",
		Profile = "SFXProfile"
	}
})

-- Load all sounds and wait for completion... (Yields)
preloader:LoadAndWait()

-- Play preloaded sounds
preloader:PlaySound("BackgroundMusic") -- Plays by ID/Name

Crucial to ensure your sounds are loaded!


API Reference

Functions

View
  • SoundUtils.create(config: SoundConfig | string): Sound - Creates a new Sound instance with the specified configuration or profile name

  • SoundUtils.createFromProfile(profileName: string, overrides?: SoundConfig): Sound - Creates a sound using a profile with optional property overrides

  • SoundUtils.createAll(configs: {SoundConfig | string}, acceptByTable: boolean): ...Sound | {[string]: Sound} - Creates multiple sounds from an array of configurations or profile names.

  • SoundUtils.createAllFromProfile(profileConfigs: {[string]: SoundConfig? | {SoundConfig?}}, acceptByTable: boolean): ...Sound | {[string]: Sound} - Creates multiple sounds from profiles with overrides.

  • SoundUtils.play(sound: Sound, debris?: boolean): void - Plays a sound with optional auto-cleanup when finished.

  • SoundUtils.playAndWait(sound: Sound, debris?: boolean): void - Plays a sound and yields until it finishes playing.

  • SoundUtils.playAsync(sound: Sound, debris?: boolean, callback?: function): RBXScriptConnection - Plays a sound and runs a callback when finished (non-yielding).

  • SoundUtils.acquireTimeUntilDone(sound: Sound): number - Gets the time remaining until a playing sound finishes.

  • SoundUtils.newProfile(profile: SoundProfile): SoundProfile - Creates a reusable sound profile stored in memory.

  • SoundUtils.newPreloader(): SoundPreloader - Creates a new preloader instance for batch sound management.

  • SoundUtils.getProfile(profileName: string): SoundProfile? - Retrieves a profile by name.

  • SoundUtils.listProfiles(): {string} - Lists all available profile names.

  • SoundUtils.removeProfile(profileName: string): void - Removes a profile from memory.

  • SoundUtils.profileCount(): number - Gets the number of created profiles.

  • SoundUtils.count(): number - Gets the number of created sounds.

Constructors & Methods

View
  • SoundPreloader.new(): SoundPreloader - Constructs a new SoundPreloader instance

    • :Add(soundId: string, name?: string, profile?: string, overrides?: SoundConfig): SoundPreloader - Adds a single sound to the preloader queue

    • :AddBatch(batch: PreloadBatch): SoundPreloader - Adds multiple sounds from a batch configuration

    • :LoadAndWait(): void - Loads all queued sounds synchronously and yields until complete

    • :LoadAsync(callback?: function): void - Loads all queued sounds asynchronously without yielding

    • :GetSound(name: string): Sound? - Gets a preloaded sound by name

    • :GetAllSounds(): {[string]: Sound} - Gets all preloaded sounds

    • :PlaySound(name: string, debris?: boolean): boolean - Plays a preloader sound by name/id

    • :PlaySoundAndWait(name: string, debris?: boolean): boolean - Plays a preloaded sound and yields until it finishes

    • :PlaySoundAsync(name: string, debris?: boolean, callback?: function): RBXScriptConnection? - Plays a preloaded sound asynchronously with callback

    • :IsLoaded(): boolean - Checks if the preloader has finished loading all sounds

    • :GetProgress(): (number, number) - Gets the current loading progress

    • :GetProgressPercentage(): number - Gets the loaded progress as a percentage

    • :ListSounds(): {string} - Lists all sound names in the preloader

    • :Remove(name: string): boolean - Removes a sound from the preloader (only works before loading)

    • :Clear(): void - Clears all sounds from the preloader (only works before loading)

    • :Destroy(): void - Destroys the preloader and all associated sounds

  • SoundProfile.new(profileConfig: SoundProfile): SoundProfile - Constructs a new SoundProfile instance

    • :Sync(updates: SoundProfile): void - Updates the profile with new values, in other words, it syncs the profile with updates

    • :GetProfile(): SoundProfile - Gets the current profile data

    • :Destroy(): void - Destroys the profile and cleans up memory

Types

View
  • SoundProfile - Defines properties used in constructing a profile
  • SoundConfig - Defines properties to construct sound Instances
  • PreloadConfig - Defines how to add sounds to the preloader per batch
  • PreloadBatch - Defines how to add sounds to the preloader using :Batch

Requirements

  • Dependencies: InstanceUtils (~ RobloxJrTrainer), TableUtil (~ Sleitnick)
  • Usage: Works anywhere! (Client, Server)
  • Performance: Light performance overhead

Important Notices

  • None that I can think of! SoundUtils is very user-friendly! If you encounter issues or you need help, please let me know and I can help! :smiley:

Conclusion

SoundUtils is a very powerful and useful utility tool for sound management, with lots of different functions/systems! This module will 100% speed up your precious development time!
Please make sure to like the post if this SoundUtils module is helpful for you! :smile:


Changelog

Version 1.0.0 (Current)

  • SoundUtils release with lots of sound management functions and classes

License

Free to use and modify for any Roblox projects. Credits appreciated but not required.


Installation

You can download here on Roblox Creator Store: SoundUtils
Last Updated: 8/3/25
Author: RobloxJrTrainer
Version: 1.0.0


6 Likes

Do you have a demo editable place to check out different sounds with the different properties and such?

Thanks

2 Likes

Can you elaborate on what you mean please?

like a game you publish that is editable , so we can play it and also edit it in studio, where it has different areas that utilize your soundutils , and when you move around there are different sounds being played with different setting , via the soundutils.. a demo place.. the we can play it, see what script and settings are used to achieve it.

Ahh I see what u mean. I’ll try to work on getting a test place out like that.

1 Like

what an awesome utility module, cheers for making it and for sharing it with us mate!

1 Like

Thanks so much, means a lot! :grin:

1 Like