Storing small audio files

I’m developing an online textbook with native pronunciation audio buttons for every word and sentence.

What would be the best place to store the audio files? They are short and small, <1Mb, but there 50+ thousand of them. The priority is that they load fast.

On a related note, is there any way to pre-load audio files for faster playback when the user actually clicks the button?

Thank you!

Why not store on S3?

What I did in the end is upload all the audio files to Google Cloud Storage (imho a superior alternative to Amazon S3, but that’s another story).

When the page loads, I generate brentjanderson:buzz objects and push them into a namespaced global array:

LIFT.Assets.Audio[src] = new buzz.sound('https://storage.googleapis.com/[APPNAME]/audio/' + src + '.mp3');

Then when the user clicks an audio button, it’s as simple as:

LIFT.Assets.Audio[event.currentTarget.dataset.src].play();
2 Likes

When the page loads, I generate brentjanderson:buzz objects and push them into a namespaced global array:

Out of interest if you are pushing the sound objects into an array, how much memory is being used by the array? I would assume that the buzz sound object is an uncompressed version of the mp3 file.