Discuss Scratch

Flowermanvista
Scratcher
1000+ posts

Use Opus audio compression

As we all probably know, the assets of a Scratch project (images and sound) tend to be the biggest space eaters, and when you are constrained to a space of 50 MB 10 MB per asset, you want to use that space as efficiently as possible. Most of us have probably also read (or even written) the many posts about this space limit, and suggestions to attempt to combat its constrictive nature. This is why I suggest that all audio uploaded into Scratch projects, by default, should be compressed with AAC Opus audio compression, or a free compression method of comparable performance. The obvious exception to this rule would be .m4a files, which usually contain AAC audio, assuming support is ever added for them.

Why?

Uncompressed audio is a massive consumer of that limited space. A typical uncompressed WAV file (CD quality, which is 16-bit stereo, 44100 Hz sample rate) will take up 10.1 MB per minute. This obviously doesn't leave much room for audio, and Scratch, as far as I know, will store the raw audio files that the user uploads. However, AAC Opus compression at 128 kbps (stereo 32000 Hz, which sounds transparent to my ears) has a 10.5:1 compression ratio, which means that AAC Opus-compressed audio would take up a mere 982 kB per minute, which is far more reasonable. For mono audio, which is most audio recorded by typical consumer microphones, the bitrate could be halved since only half the amount of data is being made in the first place, and it would sound just as good. This would leave far more room for other resources.

I also think that for advanced users, there should be a way to adjust the compression settings or disable it entirely on a per project basis, and compress any audio files that are not already compressed.

Note that AAC is a proprietary codec, which means licensing for a good encoder could cost money. For this reason, I suggest that a free codec of similar or better performance, such as Opus or Vorbis, may be used instead.

Mega edit: Updated the suggestion to use Opus instead of AAC because Opus is objectively superior for new implementations in pretty much every way - better quality for the same bitrate, and it's FOSS.

November 2019 edit: Corrected factual inaccuracy.

Last edited by Flowermanvista (Nov. 25, 2019 21:20:32)

Flowermanvista
Scratcher
1000+ posts

Use Opus audio compression

bump
Flowermanvista
Scratcher
1000+ posts

Use Opus audio compression

bump
MrFluffyPenguins
Scratcher
1000+ posts

Use Opus audio compression

support, it takes up less server space
CatsUnited
Scratcher
1000+ posts

Use Opus audio compression

Support - This would be very helpful with larger projects that contain a lot of audio files in lowering their storage. I would benefit from this as well
ResExsention
New Scratcher
1000+ posts

Use Opus audio compression

Support. I like to use large amounts of audio in my projects, this would really help.
Parametric
Scratcher
91 posts

Use Opus audio compression

Support, but I agree with your suggestion of an option to disable it. Such a feature being forced could easily be a turnoff to audio nerds (like myself ).

Also slight correction: all Scratch audio is forced-mono, and yet stereo files still take up the same amount of space.
ResExsention
New Scratcher
1000+ posts

Use Opus audio compression

Parametric wrote:

Support, but I agree with your suggestion of an option to disable it. Such a feature being forced could easily be a turnoff to audio nerds (like myself ).

Also slight correction: all Scratch audio is forced-mono, and yet stereo files still take up the same amount of space.

Oh yeah. If you want high quality audio don't compress it.

But it should be fine for like voice acting and stuff.

Upon audio import there should be an option on whether to compress it or not.
CatsUnited
Scratcher
1000+ posts

Use Opus audio compression

Parametric wrote:

Support, but I agree with your suggestion of an option to disable it. Such a feature being forced could easily be a turnoff to audio nerds (like myself ).

Also slight correction: all Scratch audio is forced-mono, and yet stereo files still take up the same amount of space.
I'm pretty sure Scratch 3 has added support for stereo sounds
Flowermanvista
Scratcher
1000+ posts

Use Opus audio compression

CatsUnited wrote:

Parametric wrote:

Support, but I agree with your suggestion of an option to disable it. Such a feature being forced could easily be a turnoff to audio nerds (like myself ).

Also slight correction: all Scratch audio is forced-mono, and yet stereo files still take up the same amount of space.
I'm pretty sure Scratch 3 has added support for stereo sounds
Yes, it does have native support for stereo sound. Just not in the sound editor for some reason, it only works when played in the project itself.
CatsUnited
Scratcher
1000+ posts

Use Opus audio compression

Flowermanvista wrote:

CatsUnited wrote:

Parametric wrote:

Support, but I agree with your suggestion of an option to disable it. Such a feature being forced could easily be a turnoff to audio nerds (like myself ).

Also slight correction: all Scratch audio is forced-mono, and yet stereo files still take up the same amount of space.
I'm pretty sure Scratch 3 has added support for stereo sounds
Yes, it does have native support for stereo sound. Just not in the sound editor for some reason, it only works when played in the project itself.
Scratch 3's sound editor kinda sucks, but I wasn't expecting it to only play in mono. What's preventing it from playing sounds in stereo?

Last edited by CatsUnited (June 10, 2019 12:23:32)

Botcho_Otkho
Scratcher
1000+ posts

Use Opus audio compression

CatsUnited wrote:

Flowermanvista wrote:

CatsUnited wrote:

Parametric wrote:

Support, but I agree with your suggestion of an option to disable it. Such a feature being forced could easily be a turnoff to audio nerds (like myself ).

Also slight correction: all Scratch audio is forced-mono, and yet stereo files still take up the same amount of space.
I'm pretty sure Scratch 3 has added support for stereo sounds
Yes, it does have native support for stereo sound. Just not in the sound editor for some reason, it only works when played in the project itself.
Scratch 3's sound editor kinda sucks, but I wasn't expecting it to only play in mono. What's preventing it from playing sounds in stereo?
Yeah. Paddle himself said he's not happy with the new changes to the sound editor. I understand that the new sound editor is because some people found the other one harder to use, but removing functionalities doesn't make something easier to use.
perhaps I went offtopic
ResExsention
New Scratcher
1000+ posts

Use Opus audio compression

Botcho_Otkho wrote:

Yeah. Paddle himself said he's not happy with the new changes to the sound editor. I understand that the new sound editor is because some people found the other one harder to use, but removing functionalities doesn't make something easier to use.

I agree. Removing features doesn't necessarily make it more simple.
Flowermanvista
Scratcher
1000+ posts

Use Opus audio compression

bump
Flowermanvista
Scratcher
1000+ posts

Use Opus audio compression

another bump
Flowermanvista
Scratcher
1000+ posts

Use Opus audio compression

bummmp
Flowermanvista
Scratcher
1000+ posts

Use Opus audio compression

please weigh in on if you think this is a good idea or not and why
ResExsention
New Scratcher
1000+ posts

Use Opus audio compression

Actually, conditional support.

This needs to be optional. Sometimes I like to have really high quality audio, and compression would just ruin it.

Support only if they add a checkbox when importing sounds, “compress audio (lower quality, less space)”
-Rex-
Scratcher
500+ posts

Use Opus audio compression

Neutral support; Scratch 3.0 already supports MP3 files.

I performed a test by converting a stereo 44100Hz 16-bit WAV file to an MP3 file using Audacity/LAME's Medium setting (joint stereo and 145–185 kbps) and achieved a similar ratio: 53509668 B/5737695 B = 9.325987

The quality was probably not as good as AAC, but it should be more than good enough for most people and is still much better than Scratch 2.0's audio quality.

Last edited by -Rex- (June 16, 2019 15:21:01)

Flowermanvista
Scratcher
1000+ posts

Use Opus audio compression

@ResExsention I have uploaded two files: one is an uncompressed recording made directly from a Sega Genesis emulator. The other is that recording encoded with AAC at 128 Kbps and turned back into a WAV file. I challenge you to tell me which one is the compressed one, and you must do it exclusively by ear. You may not use any audio editing tools.

File 1: https://cdn.discordapp.com/attachments/485256412784623626/589860473441353728/Awdio.wav
File 2: https://cdn.discordapp.com/attachments/485256412784623626/589861400453840906/Awdio2.wav

Powered by DjangoBB