For some applications, it may be necessary to load sound samples into memory and uncompress them before they can be used.
No streaming/decoding in real time means less CPU is used,
With all samples loaded in memory, it's possible to play them in sync with great precision,
It's possible to make loops, add effects, change the playback rate, etc.
And of course, if they are in memory and uncompressed, there is no wait time for them to start playing: they are ready to be used immediately!
These features are useful in video games: where a library of sounds may need to ready to be played. By changing the playback rate or the effects, many different sounds can be created, even with a limited number of samples (for instance, an explosion played at different speed, with different effects).
Click on the different buttons. Only two minimal sound samples are used in this example: shot1.mp3 and shot2.mp3. You can download many free sound samples like these from the freesound.org Web site.
Music applications such as Digital Audio Workstations (GarageBand-like apps) will need to play/record/loop music tracks in memory.
Try this impressive DAW that uses free sound samples from freesound.org! Each instrument is a small audio file that contains all the notes played on a real instrument. When you play a song (midi file) the app will play-along, selecting the same musical note from the corresponding instrument audio sample. This is all done with Web Audio and samples loaded in memory:
The author of this course wrote a multitrack audio player: it loads different mp3 files corresponding to different instruments and play/loop them in sync.
You can try it or get the sources on GitHub. The documentation is in the help menu.
Try also this small demonstration that uses the Howler.js library for loading sound samples in memory and playing them using WebAudio (we'll discuss this library later). Click on the main window and notice how fast the sound effects are played. Click as fast as you can!