scratchfoundation / scratch-gui

Graphical User Interface for creating and running Scratch 3.0 projects.
https://scratchfoundation.github.io/scratch-gui/develop/
BSD 3-Clause "New" or "Revised" License
4.34k stars 3.44k forks source link

scratch-vm extensions contains many .mp3 files #4634

Open Topppy opened 5 years ago

Topppy commented 5 years ago

using bundle analyzer ,we found the bundle contains many .mp3 files from scratch-vm/src/extensions/scratch3_music/assets/, about 3Mkbs big. Is it necessary to bundle these music files into lib.js ? How can i lazy load them?

Topppy commented 5 years ago

popo_2019-03-11  17-07-28

Kenny2github commented 5 years ago

The mp3 files are instrument samples for the various instruments that the music extension provides. They are not loaded by the client until the music extension is loaded, I believe.

thisandagain commented 5 years ago

Thanks @topppy. Splitting assets out from our main bundle is something we have been discussing quite a bit lately. Stay tuned!

thisandagain commented 5 years ago

/cc @paulkaplan @rschamp @ericrosenbaum @mzgoddard

rschamp commented 5 years ago

Here is the previous attempt to be address this: https://github.com/LLK/scratch-vm/pull/1144/

AmazingMech2418 commented 5 years ago

The best way to fix this issue would be to use a JavaScript library for MIDI synthesizers and use that to run the music rather than the preset sounds.