简体   繁体   English

如何优化 Scratch 的加载时间?

[英]How to optimize loading time on Scratch?

On Scratch I am trying to make a game that works similarly to a radio but only for a specific genre.在 Scratch 上,我正在尝试制作一款类似于收音机但仅适用于特定类型的游戏。 I uploaded a bunch of.mp3 files and started coding away whenever it struck me that it would take forever to load due to the amount of songs Scratch had to process.我上传了一堆 .mp3 文件并开始编写代码,每当我觉得由于 Scratch 必须处理的歌曲数量而需要永远加载时。 Is there a way to optimize the loading time so it won't take a long time for the songs to render?有没有办法优化加载时间,这样歌曲就不会花很长时间来呈现? Or better yet, only have the songs load when their ID is entered?或者更好的是,只有在输入 ID 时才加载歌曲?

My goal is to make it a centralized place for the music, where pretty much if you load it online then go offline, as long as the tab isn't closed or reloaded you'll have access to the songs since they were pre-loaded.我的目标是让它成为音乐的集中位置,如果你在线加载它,然后 go 离线,只要标签没有关闭或重新加载,你就可以访问歌曲,因为它们是预加载的.

If you want specifics, there are currently 20 song files (I plan on making it a big project:/) with more to come.如果您需要具体细节,目前有 20 首歌曲文件(我计划将其作为一个大项目:/),以后还会有更多。

Scratch projects load all of their files at once. Scratch 项目一次加载所有文件。 Also, for safety reasons, you cannot load a file from an external source.此外,出于安全原因,您不能从外部源加载文件。 Your best bet would be to compress the mp3 file or to reduce the audio quality of the music.最好的办法是压缩 mp3 文件或降低音乐的音频质量。 You also might want to look into converting the mp3 files into an audio format that takes up less space.您可能还想考虑将 mp3 文件转换为占用更少空间的音频格式。

However, keep in mind that you need to use public domain or other free music.但是,请记住,您需要使用公共领域或其他免费音乐。 If the song belongs to someone else, it's their property, and you don't have the legal right to use it on Scratch.如果这首歌属于其他人,那就是他们的财产,您没有合法权利在 Scratch 上使用它。 If you do, that's pirating, and, while you're unlikely to get your Scratch project taken down, it's still something you shouldn't do.如果你这样做,那就是盗版,而且,虽然你不太可能让你的 Scratch 项目被取消,但它仍然是你不应该做的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM