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

Editor: consider (optional) auto conversion of audio assets using fixed settings #2319

Open
ivan-mogilko opened this issue Jan 27, 2024 · 5 comments
Labels
context: audio context: game building related to compiling the game from input assets context: performance related to improving program speed or lowering system requirements res: in consideration what: editor related to the game editor

Comments

@ivan-mogilko
Copy link
Contributor

ivan-mogilko commented Jan 27, 2024

This is a proposal for future consideration, written after discussion in #877.

The problem is this: many game authors do not seem to realize that they are using audio of unnecessarily high quality, which results in games taking much space on disk. The peculiarity of audio formats is that reducing their quality by an acceptable degree may reduce their total size by alot.
While I do not think that we should enforce users to certain audio format settings (and besides nothing prevents them from packing game data themselves using our or third-party tools), but I suppose that we could bring their attention to this, and provide an option to fix this automatically in their games.

There's a ticket suggesting a report of game content sizes: #1967. But reducing the size would still have to be done by hand.

What I'd like to suggest for consideration is the idea for the Editor to have an optional automatic audio conversion on import.

How that might work? I suppose that the game could have a set of properties (in General Settings), defining target audio settings, such as sample size, frequency and bit rate. Perhaps these settings should be per format type (separate for mp3, ogg, wav etc) in case it's not possible to apply same for everything.
OTOH maybe it could tell to convert all imported audios to the same format type if it's compatible. For example: all wavs and mp3s to ogg, or all wavs to flac, but midi and xm/mod music should not be touched.
Whether number of channels should be among these settings is a question, maybe it could be optional. The problem is that some audio effects in game only work on mono audio (and some only on stereo).

There's still a question of implementing conversion itself (whether to use a library, or existing tool, etc), but this may be discussed after we decided on the feature itself.

@ivan-mogilko ivan-mogilko added context: audio ags 4 related to the ags4 development res: in consideration context: game building related to compiling the game from input assets context: performance related to improving program speed or lowering system requirements labels Jan 27, 2024
@ivan-mogilko ivan-mogilko added what: editor related to the game editor and removed ags 4 related to the ags4 development labels Jan 27, 2024
@ericoporto
Copy link
Member

Note that if audio compression is provided by AGS Editor, it may be reasonable that the original audio is in something like FLAC, WAV or really high quality ogg.

This would cause the audio files and the audio files in the audio cache to NOT be the same, so all types of audio reimporting have to be updated and audio quality would have to be saved somewhere in the project. Do debug runs from audio in audio cache or original source files?

@ivan-mogilko
Copy link
Contributor Author

Do debug runs from audio in audio cache or original source files?

Debug uses the AudioCache folder of course, because original files may be spread around computer, or not present at all.
But indeed, this is something to keep in mind.

@rofl0r
Copy link
Contributor

rofl0r commented Jan 27, 2024

i could imagine if the user has hq audio files, he wouldnt like if the engine automatically converts them. otoh, when he clicks "release build" or similar, the engine could do a quick calculation of estimated filesize of the audio assets (say speech at mono and 30kbit/s and music at stereo/80 kbit/s) and show a dialog with probable filesize improvements (if there's noticable improvement). the conversion could be done using another menu entry. as ags already links to libogg and libvorbis, that functionality is already included. most of it could be copy/pasted from the encoder tool that ships with vorbistools.
if the dialog pops up whenever the user creates a build, it may nag him enough to decide to do the optimization just to get rid of the dialogue ;)

@ericoporto
Copy link
Member

because original files may be spread around computer

Hopefully it's in the project and checked in version control because ideally AudioCache would be gitignored and there's no need for the imported files to be in source control, so if the user say clones (or however their source control restore non-ignored files), AGS Editor would have to rebuild AudioCache with the same parameters. I think it's best to default to not do this at all and simply copy as it's today and have this as an option. This lets people manage compression externally from the Editor.

@ivan-mogilko
Copy link
Contributor Author

ivan-mogilko commented Jan 28, 2024

Yes, my suggestion was not to force this, and only has an option in case user would like to use Editor to automate and keep things in check. This may be implemented as an option, which could be enabled or disabled by user, or done as a explicit menu command to be selected by hand, or both really.

As I mentioned above, there's already a ticket for showing game content sizes analysis: #1967. If analysis operation itself is implemented, then its results may be displayed in various ways, as seems fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context: audio context: game building related to compiling the game from input assets context: performance related to improving program speed or lowering system requirements res: in consideration what: editor related to the game editor
Projects
None yet
Development

No branches or pull requests

3 participants