Scratch-gui: Investigate saving sounds smaller

Created on 18 Sep 2018  路  4Comments  路  Source: LLK/scratch-gui

Currently all sound assets are stored in an uncompressed wav format.

We should investigate using the mp3 format to save compressed sounds.

High Impact feature needs discussion

Most helpful comment

What about OGG?

All 4 comments

An immediately obvious benefit to the relatively small file size of MP3s is that Scratchers would run into the dreaded 50MB limit much less frequently when creating projects (especially games and animations) with lots of music.

What about OGG?

i'm going to add to this doing some thinking around bit depth and frequencies to try to get sounds smaller.

Looks like scratch-flash did a few different things, entry point is this reduceSizeIfNeeded function. Before trying to save a sound, it does the following:

  • Convert from stereo to mono
  • Downsample to 22khz if 44khz
  • Use ADPCM encoding if the sound is longer than 30s at 44khz

We do not have the code for adpcm encoding ported to JS (it exists in AS here). But the first two (stereo->mono and downsampling) would get you a 4x improvement (adpcm would be an additional 4x). Those two can easily be done at the same time using an OfflineAudioContext (in fact, we do exactly this when pasting sounds together of different sample rates).

So as a first step, I think putting a resampler + stereo->mono audio processing pass on file import would get allow people to at least start editing standard length pop songs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thisandagain picture thisandagain  路  4Comments

cyx2015s picture cyx2015s  路  4Comments

rschamp picture rschamp  路  3Comments

luchotc picture luchotc  路  4Comments

chrisgarrity picture chrisgarrity  路  4Comments