Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize resource files #293

Merged
merged 1 commit into from
Apr 3, 2024
Merged

optimize resource files #293

merged 1 commit into from
Apr 3, 2024

Conversation

rhysdh540
Copy link

losslessly decrease the file size of all the sound files using OptiVorbis, saves about 3mb in final jar size

@Sollace
Copy link
Owner

Sollace commented Mar 31, 2024

Thanks, but I don't want to risk potentially breaking Minecraft's directional sound. It apparently only works with ogg files that are saved in a certain way.

I've had problems with ones before in another project which just wouldn't play and simply re-exporting them to ogg from audacity without changing anything solved it, so I really don't want to risk having to do that with as many sound files are this mod has.

@rhysdh540
Copy link
Author

I can't test at the moment, but I'm fairly certain that this process should work fine with Minecraft sounds.

from optivorbis's readme:

The [testing] dataset comprised all kinds of Ogg Vorbis files containing mono, stereo, and surround sounds at varying sampling rates, generated by a wide variety of encoders.

if you find any issues with this, please do let me know.

@AlexTMjugador
Copy link

AlexTMjugador commented Apr 2, 2024

Hello, OptiVorbis author here, I found this PR by sheer coincidence while searching for OptiVorbis uses 🙂

As @rhysdh540 stated, and as detailed in the project documentation, OptiVorbis optimizations are designed to be entirely lossless and transparent. Extensive testing, both before the project's release and after e.g. its integration with the Ambient game engine, confirmed that the audio signal remains identical after standard decoding. Thus, it's highly unlikely for OptiVorbis to cause any issues here.

In particular, Minecraft's directional sound can break when audio files are downmixed from stereo to mono (or upmixed in the reverse direction), but OptiVorbis doesn't alter this. Any file in Ogg Vorbis format (.ogg), regardless of the encoder used, is compatible with OptiVorbis. (You even can feed OptiVorbis the files it generates, although that's a pointless thing to do.)

I'm also the creator of PackSquash, a related tool for optimizing resource packs that incorporates OptiVorbis. I find it worth noting that the lossy optimizations PackSquash performs, which may require effort to get right, are not powered by OptiVorbis. Currently, OptiVorbis serves as just one component within PackSquash's broader audio processing pipeline. So if any vague recollections of audio optimization issues are based on stuff PackSquash did, please rest assured that OptiVorbis approaches optimization on a narrower scope.

Of course, any non-trivial software lacking formal correctness proofs cannot be guaranteed to be defect-free, so if any issues show up, despite my strong expectations that they won't, I'd be willing to listen and look into fixing them as my time permits 👍

@Sollace
Copy link
Owner

Sollace commented Apr 3, 2024

Alright. I guess no reason not to merge it. I'll check how things sound before it gets into a release and flag it if I find anything. Thanks @AlexTMjugador and @rhysdh540

@Sollace Sollace merged commit f625b7c into Sollace:1.20.4 Apr 3, 2024
1 check passed
@AlexTMjugador
Copy link

You're welcome @Sollace, thanks to you and @rhysdh540 for trying out OptiVorbis and contributing to making Minecraft mods more space-efficient! As stated, your feedback, whether positive or negative, is greatly appreciated, so please don't hesitate sharing any interesting thoughts about the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants