MP3 OGG WAV FLAC Loader & Streamer - Runtime Audio Loader
HyTeKGames
$15.00
(no ratings)
Jump AssetStore
Load and stream MP3, OGG, WAV and FLAC into AudioClips at runtime, from disk, URL or bytes. Pure C#, no native plugins, works on every platform. Read tags, scan folders, play in two lines.Render pipeline: not applicable.Pure C# audio-decoding library, no rendering or shaders; works with Built-in, URP and HDRP.No dependencies: no native plugins, packages or NuGet.All decoders (MP3, OGG, WAV, FLAC) are managed C#, identical on Mono and IL2CPP. Platforms: Windows, macOS, Linux, Android, iOS, WebGL.Demo UI works with legacy and new Input System. .NET Standard 2.1.🎵 Introducing Runtime Audio Loader for Unity! 🎵Need to play music or sound that ships outside your build? Load MP3, OGG, WAV and FLAC into an AudioClip at runtime, straight from disk, a URL, or raw bytes. Pure C#, no native plugins, no extra packages, and it works on a fresh project in two lines.Works perfectly with Unity 2021, 2022, 2023, Unity 6, 6.1, 6.2, 6.3, 6.4!🌍 Truly Cross-Platform:All four decoders are pure managed C# and produce identical results on Windows, macOS, Linux, Android, iOS and WebGL, under both Mono and IL2CPP. No per-platform native libraries.⚙️ Runtime Audio Loader seamlessly handles:MP3, OGG/Vorbis, WAV (8/16/24/32-bit + float) and FLAC.Loading from disk paths, http/https URLs, or byte[] in memory.Three call styles: synchronous, async/await, and coroutine + callback.Streaming long tracks without loading them fully into memory.Reading duration, channels, sample rate and tags (artist/title/album) without a full decode.Scanning a whole folder into a ready-to-play playlist with metadata.Progress reporting and cancellation on async loads.🧩 Drop-In Simple:Add one using, call AudioLoader.Load, and you are playing audio.Full C# source code included, with a demo scene and documentation.🚫 Format Disclaimer 🚫AAC/M4A and Opus are not supported (they fail with a clear error).Embedded tags are read from OGG and FLAC; MP3 and WAV report format, duration and channels but no tags.🌐 Versatile Applications:User-generated content: let players load their own music and sound.Streamed/downloaded audio: pull tracks from a server at runtime.Modding & DLC: load audio from external folders or asset bundles.In-game music players: scan a folder and build a playlist instantly.📞 SupportFor assistance, whether you have an inquiry, encounter an issue, or wish to propose a new feature, please feel free to reach out using the following contact options:Email: assetstore@hytekgames.netDiscord Username: iamtekDiscord Server: Join HereFor expedited assistance, I recommend joining my Discord server, where you can typically receive support within an hour (unless I'm asleep). I look forward to helping you!🌟 Feedback Welcome!Your positive reviews mean a lot! If the asset has been beneficial, I'd be grateful for your positive feedback. If you've encountered any challenges, please reach out to me, and I'll do my best to address and resolve them to your satisfaction.Happy listening! 🎵🛠️Runtime Audio Loader decodes MP3, OGG/Vorbis, WAV and FLAC into Unity AudioClips at runtime. It is a pure C# library: no native plugins (.dll/.so/.dylib), no third-party packages, no NuGet, and no extra setup. Drop it into a fresh project and call it in two lines.🚫 Format Disclaimer 🚫AAC/M4A and Opus are not supported (they fail with a clear error).Embedded tags are read from OGG and FLAC; MP3 and WAV report format, duration and channels but no tags.DECODING- MP3: MPEG-1/2 Layer III (decoder based on NLayer, MIT).- OGG: Vorbis (decoder based on NVorbis, MIT).- WAV: PCM 8/16/24/32-bit and 32-bit float (RIFF).- FLAC: native lossless decoder.- AAC/M4A and Opus are not supported and fail with a clear, typed error (never silently mis-read). Purely unsupported due to licensing.All four decoders are managed C# and produce identical samples on every platform under both Mono and IL2CPP.SOURCES- Local files: absolute paths, persistentDataPath, StreamingAssets.- Remote URLs: http/https, downloaded then decoded.- Raw bytes: byte[] in memory (asset bundles, encrypted blobs, TextAssets).API- Three call styles: synchronous (Load), async/awaitable (LoadAsync), and coroutine + callback (LoadRoutine).- Every call returns a typed AudioResult; nothing is thrown for bad input. Errors come back as a typed AudioError plus a message.- Probe / ProbeAsync read format, channels, sample rate, duration and tags (artist/title/album) without a full decode.- AudioLibrary.ScanFolder / ScanFolderAsync scan a folder and return metadata for every track, ready for an in-game music browser.- Progress reporting (IProgress) and CancellationToken support on async loads.STREAMING- Stream long tracks instead of loading them fully into memory: decoding runs on a background thread and feeds the audio thread through a reused ring buffer.- The audio-thread callback is allocation-free; on underrun it outputs silence rather than glitching.- Streamed clips own background resources; call AudioLoader.Release(clip) when done (a no-op for full-load clips, so it is always safe).PLATFORMS- Windows, macOS, Linux, Android, iOS and WebGL.- WebGL is single-threaded: off-main-thread decoding and threaded streaming automatically fall back to main-thread work; prefer full load there.- WebGL has no direct file access; load from a URL or byte[].NOTES- Tags (artist/title/album) are read from OGG and FLAC. MP3 and WAV report format, duration and channels but no embedded tags.- Render pipeline agnostic: no rendering, shaders or materials, so it works with Built-in, URP and HDRP.- Demo UI works with the legacy Input Manager, the new Input System, or both, with no configuration.- Scripting: .NET Standard 2.1. Tested on Unity 2021.3 LTS and Unity 6 (6000.4).- Source code included. Bundled MIT decoders are redistributable; see Third-Party Notices.txt.AI has been used as auto-completion in my IDE and to improve my original design of the asset store visuals/assets.




