Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Strategies for reducing audio file size?
- Astro947
-
Scratcher
5 posts
Strategies for reducing audio file size?
Hi all, I'm having a problem with audio file size on my project and I'm interested if anyone here has ever tried to find the best fix for it. Our collaborative project increased by 70mb over a few days from mostly additions to our audio. Are there any best practices for trying to minimize this?
One idea I have is to download the project, open it in 7ZIP, find the largest audio files and compress them, then to re-upload the project with the compressed audio. This is to skip the conversion process whenever an audio file is uploaded using the Scratch editor. However, I'm not sure what the best compression format would be if I went this route.
Any other solutions/speculations related to this topic would be appreciated. Thanks a lot!
One idea I have is to download the project, open it in 7ZIP, find the largest audio files and compress them, then to re-upload the project with the compressed audio. This is to skip the conversion process whenever an audio file is uploaded using the Scratch editor. However, I'm not sure what the best compression format would be if I went this route.
Any other solutions/speculations related to this topic would be appreciated. Thanks a lot!
- Andreto
-
Scratcher
100+ posts
Strategies for reducing audio file size?
There are a lot of ways to minimize the file-size of your sounds. The problem is that you will lose sound quality.
Is there any particular reason why you would want to minimize the file size of your project? Is scratch giving you warnings?
Is there any particular reason why you would want to minimize the file size of your project? Is scratch giving you warnings?
- Astro947
-
Scratcher
5 posts
Strategies for reducing audio file size?
Yes we're worried that Scratch is going to start having issues if the project gets much bigger. Are there any sound formats that are guaranteed NOT to get larger when uploaded?
- Sheep_maker
-
Scratcher
1000+ posts
Strategies for reducing audio file size?
Quite sure Scratch converts everything to WAV anyways to upload it to their assets server, and I don't think WAV compresses well
- CalculatorFun
-
Scratcher
94 posts
Strategies for reducing audio file size?
Quite sure Scratch converts everything to WAV anyways to upload it to their assets server, and I don't think WAV compresses wellFrom observing a 3.0 project zip, it also shows .mp3 files, also I think .flac files compress nicely from what I've heard at least.
- MegaApuTurkUltra
-
Scratcher
1000+ posts
Strategies for reducing audio file size?
Here's some info about audio formats that may be helpful
First it's important to understand that digital audio is just a giant list of numbers (and for stereo, two lists of numbers). The numbers specify the value of the audio waveform at a certain time, so you could for example graph the numbers on the y axis and time on the x axis and get the graph of what the audio waveform looks like. Usually, digital audio will come at a sampling frequency of 44.1KHz, which means there are 44.1K numbers (for each of the left and right stereo channels) that tell you what one second of audio is like.
Scratch 2 used WAV for everything which resulted in giant project, but it looks like in Scratch 3 if you upload an MP3 file it will put that directly in the project without converting to WAV. So your best bet would be to encode all your audio as MP3 with something like Audacity with a bit rate that gives you small enough file sizes, then upload that to your project.
First it's important to understand that digital audio is just a giant list of numbers (and for stereo, two lists of numbers). The numbers specify the value of the audio waveform at a certain time, so you could for example graph the numbers on the y axis and time on the x axis and get the graph of what the audio waveform looks like. Usually, digital audio will come at a sampling frequency of 44.1KHz, which means there are 44.1K numbers (for each of the left and right stereo channels) that tell you what one second of audio is like.
- WAV: Contains just the numbers, with some information at the beginning that tells you this is a WAV file and some other info. WAV makes no attempt to compress the data at all, it's just the plain list of numbers, which means WAV files are usually giant. On the upside, you're guaranteed to store the full original audio data without losing any information to compression
- FLAC: This is the format most audio enthusiasts prefer. FLAC uses lossless compression, which means it tries to identify patterns in the audio that allow it to be stored in less space than WAV most of the time, but decompressing the data will give you back the original audio.
You can think of compression like this: suppose you wanted to compress the text “meow meow meow meow meow meow”. You could represent this as “meow x6” which means exactly the same thing. And you could even say: “meow” will be represented by the letter m; “m x6” which is even shorter, but still means the same thing.
Though in the worst case, if there are no patterns in the audio data (eg if you try to encode white noise) then it should be the same size as WAV.
Also, Scratch doesn't seem to support FLAC which is a little unfortunate
- MP3: This format uses lossy compression, which means that like FLAC it tries to fit the data into less space, but it will also delete “unimportant” parts of the data to get even smaller size. MP3 is tuned to eliminate parts of the audio that are difficult for humans to hear so it will sound nearly the same as the original audio, but it won't be exactly the same. MP3 also has settings for how much data to eliminate, and eliminating more results in worse audio quality.
More specifically MP3 encoders will allow you to select a “bit rate”, which is a setting for how big the MP3 file should end up being (per second of audio). Selecting 320 kbps results in generally good audio quality, but anything below 128 kbps starts sounding a little off.
Scratch 2 used WAV for everything which resulted in giant project, but it looks like in Scratch 3 if you upload an MP3 file it will put that directly in the project without converting to WAV. So your best bet would be to encode all your audio as MP3 with something like Audacity with a bit rate that gives you small enough file sizes, then upload that to your project.
- Discussion Forums
- » Advanced Topics
-
» Strategies for reducing audio file size?





