Nenkai / SGXDataBuilder

Creates and builds Sony SGX / SGXD Audio Banks ( sgd / sgh / sgb ) from standard audio formats (wav/ac3).
3 stars 1 forks source link

SGD building doesn't work in Kurohyo 1/2 #1

Open dawnofviolence opened 1 year ago

dawnofviolence commented 1 year ago

As title suggests: built SGD's do not work in Kurohyo 1/2. Comparing a SGD built from SGXDataBuilder and an original SGD, SGXDataBuilder builds them incorrectly - Kurohyo 1/2 uses ATRAC for single audio banks, and WAVE for its multiple audio banks. SGXDataBuilder cannot replicate either, and results in a game crash when inserted

Below is an original multi-audio bank from the game: se_battle_original.zip

Here it is rebuilt using SGXDataBuilder: se_battle_new.zip

If you compare the two in a hex editor, SGXDataBuilder appears to be building it differently. On top of this however unrelated - SGXDataBuilder seems to hang while multi-audio banks using .wav, while works fine with .ac3

Nenkai commented 1 year ago

Hi! Thanks for the report.

Could you try again with 1.0.3? I did identify a bug regarding building from wave files.

The sample you provided seem to consist exclusively of PS-ADPCM instead of WAVE or even ATRAC/AC3. The tool does not build these kind of files, but I was able to confirm in other games that building from other formats functions correctly. Also I noticed that there were only 44 entries in your newly built SGD instead of 63, if that was intentional.

Also, the tool does not attempt to create a SGD that is identical. It is not its purpose, it is intended to build files that can be played back from within games. The format is usually more complicated than being just a sound container, as such, I was able to identify one of the entries in the original SGD that you provided using markers, which is also unsupported.

dawnofviolence commented 1 year ago

Hello, my bad about the sample error, I didn't even check to see what other formats they might've used. The issue about the newly built SGD being only 44 entries was because of 1.0.2, where it would hang after processing that amount of files and be stuck forever until I closed the command prompt. 1.0.3 fixes the hanging issue, so now I just have to see how to get around the PS-ADPCM thing. Thank you!

Nenkai commented 1 year ago

You should still be able to build a SGD that works regardless of the input format.

The hanging also happened to be an issue I solved. Please do report if this now works correctly.

dawnofviolence commented 1 year ago

Unfortunately it seems like Kurohyo 1/2 is incredibly picky about its formats and crashes if I insert anything but ATRAC3 for single-audio SGD's, & PS-ADPCM for multi-audio ones.

However, 1.0.3 does fix the hanging issue, as I was able to build the entire SGD from .wav whereas the last time it would get stuck at the 44th entry.

dawnofviolence commented 1 year ago

Also it seems that trying to load the new SGD in foobar2000 using vgmstream results in this, so maybe the game actually isn't picky about the formats after all, I don't know image

Nenkai commented 1 year ago

vgmstream does not support Wave PCM LE within SGD's, which is the reason I added a new option to use BE with --wave-big-endian, just for previewing them there. AC3 should work as-is.

For the rest, I might have look at it myself.

dawnofviolence commented 1 year ago

Ah. That option did fix vgmstream, but unfortunately Kurohyo does still crash with the different format, I also have tried it with .ac3 through the tool before, to no success.

Nenkai commented 1 year ago

Did some more research. It appears as the SGX library on PSP only supports PS-ADPCM and ATRAC3 as audio formats, WAV and AC3 seem unsupported and cause no-audio or a hang. I have gotten it to work using ATRAC3 inputs, however it's pretty clear that the tool needs to go through some refactoring.

Nenkai commented 1 year ago

Could you try again with 2.0.0?

dawnofviolence commented 1 year ago

Everything works in 2.0.0. Thank you very much

dawnofviolence commented 1 year ago

Actually, side note - I'm noticing with PS-ADPCM it'll work around half the time, I inserted a custom voiceset and it worked (but was very quiet which was my fault), remade it but a little louder, and it broke. Also tried with the original sample of se_battle and that broke both times I built it. Unsure if this has anything to do with a bug in SGXDataBuilder as this happens purely in-game, where sounds will either be very loud screeches, completely mixed up for whatever reason, or sometimes both like in this video (had to upload to youtube, was too big for github) https://www.youtube.com/watch?v=yuPrQI0dhC0

dawnofviolence commented 1 year ago

I've also noticed a few issues in the GUI: Clicking on "Import Audio Source" crashes the program Trying to set a loop start & end point doesn't work, resets after I either click off one of the input boxes or click OK