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

Hitman Contracts: Cannot replace audio successfully #3

Open
Deji69 opened this issue May 16, 2024 · 2 comments
Open

Hitman Contracts: Cannot replace audio successfully #3

Deji69 opened this issue May 16, 2024 · 2 comments

Comments

@Deji69
Copy link

Deji69 commented May 16, 2024

I'd really like to replace two licensed music tracks in the game: Put Your Head On My Shoulders and Puressence.

So far I'm only trying to replace the Paul Anka track (Music_PutYourHead.wav). I've tried exporting everything to a folder, replacing just that file, and reimporting the folder. Sometimes the streams.wav ends up being 2MB so I know it's failed, other times the streams.wav is a relatively normal size (but always smaller than the original, even though my replacement file sizes are larger), but most of the music and SFX in the game end up completely broken and inaudible.

Next I've tried removing all the files I don't want to modify from the folder and re-importing just the one file, unaltered, into the original streams.wav. Instead of showing only the modified file as yellow in the diff, all files within 'Streams' show as yellow ('Scenes' stays white). I save this, and in the best case scenario, all of the sound in the game is fine other than the track that was reimported. It's just silence in place of it.

Any insights onto how to successfully do this process? It's unclear even how things are supposed to work.

@Deji69
Copy link
Author

Deji69 commented May 17, 2024

Okay, I think managed to figure out a working process:

  • Files need to be exported without "Transcode to easily playable PCM format on export" setting enabled.
  • Files re-imported must match the exported file in size exactly in order to produce a correctly-sized streams.wav - else the game will start playing tracks wrong or not at all.
  • For a WAV file I replaced, I used the IMA ADPCM encoding in Audacity and matched the sample rate, channels and duration of the track. This gave a consistent file size no matter the contents, that matched the original.
  • For an OGG file I replaced, I had to reduce the quality until it made a lower sized file than the original and add extra duration filled with low volume white noise, until the file size was close to the original. Then I padded the remaining size using metadata.
  • I turned OFF "Fix the number of channels on import" and "Fix the sample rate on import".
  • I reimported files one at a time, restarting the tool and opening the previous streams.wav to replace each new file. Maybe not necessary but it felt like progress at the time.
  • Overwriting existing streams.wav appeared to not work, so I exported to a new folder that I moved into the game folder afterwards.

So I have two songs in the game, each with different formats, replaced in the game now without breaking anything else.

Would be nice if this didn't require so many hacky manual steps, but just glad to be able to pull this off now. Thanks for the tool btw @WSSDude.

@WSSDude
Copy link
Collaborator

WSSDude commented May 17, 2024

Yeah... Its not the best to say the least in terms of the UI/UX. Not mentioning that, if you don't have enough RAM, it may do quite a few weird things, as the tool works with the files in-memory atm. I never really focused on those as this was made for dubbing project and it was good enough for purpose of that.

I observed issues with some settings when I started refactoring it into some more reusable pieces if someone wanted to use decoder/encoder in something else (maybe for some more proper mod tool for example that is not just a simple replacer in the end) and left it sort of mid dev... The defaults should always work but I think I saw the same issue with Contracts specifically, unsure now.

Older builds without Blood Money may work better with these, as Blood Money, Kane & Lynch and Mini Ninjas were 3 last games I was doing edits for (which may have broke those previous ones).

I'll try to amend some of these eventually, just need to find time and make it build on Linux first or setup some CI, as I completely got rid of the Windows by now and I use few platform-dependent things in the tool requiring porting. Will need to think of how to approach that one.

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

No branches or pull requests

2 participants