Audioclip loading is slow.

Discussion and help for Easy Save 3
Post Reply
Developer36
Posts: 2
Joined: Thu May 21, 2020 5:06 am

Audioclip loading is slow.

Post by Developer36 »

Hi Moodkie Team,

I have been using esaysave for all saving related stuff in my game and its awesome to use. I have a scenario where the user adds a song in runtime from windows explorer and I save it to the disk with ES3.Save<AudioClip>() command. Next time when the user open the game the saved song will be loaded again that was saved previously. But I feel like the loading of the song takes more time.
Is there any workaround or advice to speed up the loading of the audioclip ? Will putting it in a different thread help to speed up loading?

Thank You!

User avatar
Joel
Moodkie Staff
Posts: 2755
Joined: Wed Nov 07, 2012 10:32 pm

Re: Audioclip loading is slow.

Post by Joel »

Hi there,

AudioClips are inherently large, so they're always going to have quite a large performance impact.

However, the first thing I would do is instead of loading the user's audio file and then using ES3.Save<AudioClip> to save it to disk, save their audio file directly using:

Code: Select all

ES3.SaveRaw(ES3.LoadRaw(PathToAudioFile), "MyAudioFile.wav");
You can then load this audio file using:

Code: Select all

var audioFile = ES3.LoadAudio("MyAudioFile.wav");
This ensures that the data remains in encoded format, and that it's decoded by the hardware where possible.

All the best,
Joel
Joel @ Moodkie Interactive
Twitter - Unity

Developer36
Posts: 2
Joined: Thu May 21, 2020 5:06 am

Re: Audioclip loading is slow.

Post by Developer36 »

Thank you so much for your quick response. :)
Using the process as you have mentioned solved the lag. Now the audio/song loading is instantaneous.

Post Reply