How do I load audio in the background while the script is still running?

I’m currently scripting a jukebox and it’s coming along great, but when the player changes the selected song they have to wait for the audio to load which can take 3-6 seconds, and I want the song switching to be more fluid.

I’ve had the idea to load the audio that comes before and after the current music playing to load while the music is being played. Any ideas on how I can do this without pausing the script to wait?

Unsure if this is an issue with taking in Audio files from the Library and placing them in.
I never really noticed a big delay, and I could only suggest making it a feature instead of a bug (Cliche am I right?)

Audios have a function called PlaybackLoudness. You could have a loading screen on the JukeBox like “Loading disk” until this value is greater than 0.

1 Like

I’ve come up with a solution where the script starts to load the audios before and after the currently playing audio when the user plays the audio. This way the song starts and then the audios load, pausing the script but the music still plays.

PreloadAsync has been overlooked. Why don’t you try using this API?

1 Like

Thank you for this, I’ll look into it!