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

[Enhancement] Re-add support for WAV audio (was present in at least Confrontation v1.1) #115

Open
NintendoManiac64 opened this issue Jun 26, 2022 · 13 comments
Labels
enhancement Change to or improvement of existing behavior

Comments

@NintendoManiac64
Copy link

NintendoManiac64 commented Jun 26, 2022

Metroid Confrontation (at least v1.1) supported the use of WAV audio files for its music, but the final version of AM2R lacks this ability.

So, simply put, I think re-adding this could be a good idea.

In the past, the storage requirements of uncompressed WAV was much more of an issue but, as time has gone on, lossless formats like FLAC are more mainstream than ever, MP3 now has had all of its patents expired and, for most new use-cases, Opus has replaced Vorbis.

WAV support would provide the benefit of lossless audio support while being such a lowest-common-denominator that even people that have never heard of "OGG", "Vorbis", or "Opus" yet know of "MP3" tend to know what a WAV file is. And of course, WAV files are also gapless just like Vorbis and Opus.

I also considered the possibility of formats like FLAC, but I figured plain old WAV would be much easier to support due to its nature of just being straight-up uncompressed linear PCM.

The one niggle is that, depending on how support is implemented, one may need to still give WAV files a .ogg file name which may be a bit odd for less-savvy people that aren't aware that the file extension is merely a hint regarding the format rather than the rule (this of course wouldn't be an issue if files with a .WAV extension could actually be properly supported as was the case back in at least Metroid Confrontation v1.1)

My main interest was being able to modify the existing in-game music a little bit without having to worry about the generational-loss of re-encoding lossy audio into lossy audio a second times, especially when I've got literally hundreds of gigabytes free to work with...

Also fun fact, this is me:

EDIT: According to that forum thread, the sound effects are already WAV files, but I don't know how to check it myself since software-coding things are totally not my expertise (and I similarly can't test its capabilities, e.g. does it max out at 48kHz 16bit or can it even support 96kHz, 192kHz, etc at 24bit, 32 bit floating point, etc?)

Nevertheless, this makes me think that all that would be required is to somehow hook into this existing LPCM WAV decoder.

@NintendoManiac64 NintendoManiac64 added the enhancement Change to or improvement of existing behavior label Jun 26, 2022
@Lojemiru
Copy link
Collaborator

To my knowledge, we really can't do this. GameMaker: Studio 1.4 only has support for OGG files for streaming from disk. The reason Confrontation had WAV support is likely because of differences in pre-Studio versions of GameMaker.

@NintendoManiac64
Copy link
Author

NintendoManiac64 commented Jun 26, 2022

It would seem that I didn't get my edit in quick enough!

Basically the sound effects supposedly are already WAV files, implying that AM2R already has the capability to decode them in some manner.

@Miepee
Copy link
Contributor

Miepee commented Jun 26, 2022

GameMaker: Studio 1.4 only has support for OGG files for streaming from disk

Sound effects are not being streamed from disk.

@NintendoManiac64
Copy link
Author

NintendoManiac64 commented Jun 26, 2022

Well now the question would be, in the hypothetical situation where WAV music was hooked into the existing way that AM2R handles sound effects, would this mean that it'll store every single possible WAV music in RAM, or only the currently-playing WAV music in RAM?

Much like disk space, RAM has also become less and less of an issue (my sister's free-from-the-carrier smartphone has more RAM than the PC that I did my original Confrontation v1.1 speed run on - 2GB VS 768MB - let alone the improvised NUC-like PC with 16GB of RAM I'm typing this from) and, because WAV is already uncompressed, the size of a WAV file is going to be exactly the amount of RAM that it'd take up.

@Lojemiru
Copy link
Collaborator

Some further poking suggests that one might be able to abuse buffers to load uncompressed audio from disc (at least in Studio 2, not sure about 1.4), but that has the significant drawback of loading the entire audio file into memory at once. That's not really ideal given how large the audio files we're talking about are and how weak some of our target platforms (Android) are.

As far as how AM2R currently handles WAV files: they're baked into the datafile and lose the ability to be readily manipulated by end users. They're also totally loaded into memory when their audiogroup is in use.

@Miepee
Copy link
Contributor

Miepee commented Jun 26, 2022

And since they're baked into the datafile, one would essentially have to recompile the game / mod the game for custom SFX (or in your case music) changes. Which would defeat the entire purpose of this request; have them easily replaceable as a feature without such drastic measures.

@NintendoManiac64
Copy link
Author

NintendoManiac64 commented Jun 26, 2022

Wait so, regardless of the possible RAM requirements (if it only loads the currently-playing song then I question the issue; on mobile I would imagine you'd run into CPU performance issues before RAM issues, or even OS compatibility issues and storage-capacity issues), are you basically saying that it isn't even possible to have external WAV files hook into the method that is currently used for sound effects?

In other words, this idea would only work if they were packaged into the datafile, not with easily-accessable WAV files?

@Lojemiru
Copy link
Collaborator

Lojemiru commented Jun 26, 2022

Correct, we can't just pass WAVs into the default loading; we'd need to specially code for it and I'm not sure how the memory requirements stack up compared to normal. This is a GameMaker restriction, not an AM2R restriction.

@NintendoManiac64
Copy link
Author

NintendoManiac64 commented Jun 26, 2022

Well that's unfortunate.

Unless a miracle happens and, for whatever reason, someone actually decides to do the heavy-lifting required to implement this, I guess I'll just have to try to get Doc to share the original uncompressed versions of the in-game music (so far I've not succeeded in that regard, though it's only been a week).

@Miepee
Copy link
Contributor

Miepee commented Jun 26, 2022

AFAIK the original uncompressed versions are available on soundcloud under a creative commons license
https://soundcloud.com/user-64632134/sets/am2r-original-soundtrack

@NintendoManiac64
Copy link
Author

NintendoManiac64 commented Jun 26, 2022

AFAIK the original uncompressed versions are available on soundcloud under a creative commons license https://soundcloud.com/user-64632134/sets/am2r-original-soundtrack

As I mentioned in my original forum thread linked in the first post here, the OST has a worse dynamic range than the in-game music to the point that, even with the lossy compression, the "HDR HQ music" can have a higher-quality result.

Also there's the looping issue whereby the official OST is not designed around that and would require lots of manual editing (which I can do and have lots of experience with, but it still seems pointless when it's arguably a lower-fidelity starting point anyway)

EDIT: Hmmm, my forum link is giving a 404 error now. Let me see if I can fix that...

@Lojemiru
Copy link
Collaborator

Sorry we couldn't be of more immediate help. I'll definitely look into audio streaming when I do a pass on audio for 2.0, but until then we're stuck here.

On that note, you seem to be a very informed individual when it comes to audio; you wouldn't happen to do SFX work and be looking for a portfolio project, would you? While the OST's in a good state thanks to your pack on the forums (I believe it's the one Gatordile added as the HQ version), there's a lot of low-quality/ripped SFX that we're interested in redoing but lack the skill to make ourselves. We have one contact who's given us a few new sound effects, but he's been extremely busy ever since.

@NintendoManiac64
Copy link
Author

NintendoManiac64 commented Jun 26, 2022

Unfortunately sound effects are not something I have much experience with. Also, creation & composition in general is something that I have even less experience with - one could say that my knowledge and skillset could make one consider me a "mixing engineer" more than anything else.

And yes, the high-quality music that's been used for years and years was the copy that I originally distributed.

Also, I still have no idea why my old forum thread link works in Pale Moon but not LibreWolf. Nevertheless, a copy is on archive.org which works on LibreWolf:

EDIT: Oh, and don't let me stop you (or anyone else) if one wants to support fancier lossless formats like FLAC and/or WavPack! :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Change to or improvement of existing behavior
Projects
None yet
Development

No branches or pull requests

3 participants