Tutorial How to swap audio in Unreal Engine 4 games

masagrator

The patches guy
OP
Member
Joined
Oct 14, 2018
Messages
5,147
Trophies
2
XP
9,163
Country
Poland
Because of @Kirby567fan idea I've been working on figuring out how to swap audio from Yoshi's Crafted World. And probably all UE4 games on Switch uses the same format for audio.
It can be achieved by doing app, but this tutorial is barebone as possible. :P

Example of what can be achieved:

How to unpack game:
https://gbatemp.net/threads/how-to-easy-extract-game-files-from-nsp-xci.534724/#post-8572631

What you needPreparing game files to be modifiedSwapping fileCorrecting infoPacking

  1. - Audio files converted to RIFF (.wav).
    - Hex Editor (I'm using HxD)
    - UEViewer (http://www.gildor.org/en/projects/umodel#files)

  2. First run umodel.
    Show path to game's romfs folder included.
    And rest check as showed lower (for v5 pack use Unreal Engine 4.20, for v7 pack use Unreal Engine 4.21)
    upload_2019-4-8_23-33-35.png

    And OK.

    After few seconds it should show files. Go to All packages->Game
    Find folder with audio. For our game background music is in
    Code:
    All packages\Game\Assets\Sounds\BGM\Wave
    upload_2019-4-8_23-58-24.png

    We are searching for our audio that we want to modify, right click on it and "Export". Again right click and "save packages".
    Now in umodel folder they should be folders named UmodelExport and UModelSaved.
    upload_2019-4-9_0-21-30.png

    For our game wav file unpacked to
    Code:
    UmodelExport\Game\Assets\Sounds\BGM\Wave
    *.uexp file and *.uasset file are in
    Code:
    UmodelSaved\Game\Assets\Sounds\BGM\Wave

    Check properties of *.wav file.
    You need to convert size in bytes of wav file to Hex Little Endian.
    Find any hex calculator. For 99% it will be Big Endian. How to convert this to Little Endian? By reversing bytes.
    Code:
    Big Endian -> Little Endian (always 4 bytes for this tutorial, if our big endian value is lacking it, we are adding it at the end of file)
    07 01 -> 01 07 00 00
    0A 04 76 -> 76 04 0A 00
    01 78 65 2A -> 2A 65 78 01
    1 35 87 9C -> 9C 87 35 01

    For example our file has size 10 584 046
    upload_2019-4-9_0-0-19.png

    Now converted value will look like:
    Code:
    ByteSize -> Hex Big Endian -> Hex Little Endian
    10584046 -> A17FEE -> EE 7F A1 00

    How to check if you correctly calculated this number?
    Open with hexeditor your *.uexp file and try to find these hex values. It should be found 2 times at the beginning of file next to each other.
    upload_2019-4-9_0-3-26.png
  3. Open your unpacked by umodel original *.wav file with hex editor. Open also *.uexp file with this audio.
    Find in *.uexp file 4 bytes after string "data".
    upload_2019-4-9_0-4-13.png


    Try to find these hex value at the beginning of file and remember it's position.
    upload_2019-4-9_0-4-39.png


    Next you need to highlight the same data in *.uexp file that are in whole original *.wav file (images are from *.uexp file)
    upload_2019-4-9_0-6-32.png

    ----------------
    upload_2019-4-9_0-6-20.png


    Open with hex editor your audio that you want to use, highlight it all, copy it and paste to *.uexp file in place of highlighted data.

    Now you need to copy first 4 bytes after "data" string in modifiex *.uexp file to place that you needed to remember and rewrite it.
    upload_2019-4-9_0-8-24.png


    Next you need to check properties of your new wav file and convert it's size to hex little endian as earlier.
    upload_2019-4-9_0-10-4.png


    Code:
     30682066 -> 1D42BD2 -> D2 2B D4 01

    Now you need to swap in *.uexp file each one of these 2 values next to each other found earlier with these converted size of your new wav file.
    upload_2019-4-9_0-11-40.png


    Aaaaaaand.... Save it.
  4. Open *.uasset file for your modified *.uexp file with the same name.
    Now bring back size of old *.uexp file, substract 4 from it. Convert this number to hex little endian.
    upload_2019-4-9_0-12-55.png


    Code:
    10584259-4 = 10584255
    10584255 -> A180BF -> BF 80 A1 00
    Find it in *.uasset file with hex editor.
    upload_2019-4-9_0-14-12.png


    Now check size of your modified *.uexp file, substract 4 from it's value and convert it to hex little endian.
    upload_2019-4-9_0-15-3.png


    Code:
    30682279-4 = 30682275
    30682275 -> 1D42CA3 -> A3 2C D4 01
    Paste it in place of highlighted value in *.uasset file.
    Save.
  5. Everything about packing to *.pak file you have here (don't move *.pak file from it's original place if you want to continue modifying audio files. Copy it to unpacked archive of UnrealPak):
    https://gbatemp.net/threads/how-to-unpack-and-repack-unreal-engine-4-files.531784/

    You don't need to unpack whole game. Just create lista.txt, clean it, delete all lines except audio and put modified files to correct folders, in our game it will be
    Code:
    UnrealPakSwitch\PJ033\Content\Assets\Sounds\BGM\Wave

    And use Patch tab.

    If you will do something wrong, game will crash. :P
 
Last edited by masagrator,

xstationbr

Well-Known Member
Member
Joined
Dec 30, 2015
Messages
110
Trophies
0
Age
40
XP
443
Country
Brazil
Hummm... maybe now can i play DOOM in Portuguese BR? Cause the game ROM have AUDIO PT BR, but Nintendo dont allow us change console to Brasil Country. Just Portuguese Portugal Country.
Waiting to anyone found a way.
Sad..
 

masagrator

The patches guy
OP
Member
Joined
Oct 14, 2018
Messages
5,147
Trophies
2
XP
9,163
Country
Poland
Hummm... maybe now can i play DOOM in Portuguese BR? Cause the game ROM have AUDIO PT BR, but Nintendo dont allow us change console to Brasil Country. Just Portuguese Portugal Country.
Waiting to anyone found a way.
Sad..
If you want a language, write to me. I already implemented Polish Translation to this game.
But not audio.
 
Last edited by masagrator,
  • Like
Reactions: xstationbr

xstationbr

Well-Known Member
Member
Joined
Dec 30, 2015
Messages
110
Trophies
0
Age
40
XP
443
Country
Brazil
If you want a language, write to me. I already implemented Polish Translation to this game.
But not audio, because there is no Polish audio in game files and PC version audio is not compatible.

Thank you but is not POLISH, is Portuguese Audio, from Portuguese Brazil.
If you know an way to access the Default .ini setings on this game to SWITCH and change from English to PT-BR ou PORTUGUESE i will be so greatfully to you.
I dont know any way to explore files inside XCI to try by my self an way to test but if you know. thank you. show us how to do.
 

masagrator

The patches guy
OP
Member
Joined
Oct 14, 2018
Messages
5,147
Trophies
2
XP
9,163
Country
Poland
There are two ways to do it: modify exefs or decrypt language files, swap it and encrypt again (every language has different key).
I will try to check today.
 

br7an5477

Member
Newcomer
Joined
Nov 6, 2019
Messages
10
Trophies
0
Age
23
XP
206
Country
United States
Just tried this with FighterZ and I'm stuck at the conversion part of the tutorial. I have it exported and everything but the audio is in SWITCH_AUDIO format, not wav. Has anyone else encountered this?

Edit: I converted it using VGMGUI and now its .wav. It reads as UE4 Switch Audio. I am assuming that I have to use UE4 to import and change the file manually?
 
Last edited by br7an5477,
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Dark_Phoras @ Dark_Phoras:
    The younger generation uses mostly TikTok and YouTube, some Instagram. It seems like they don't care so much about social profiles.
    Gift
  • KenniesNewName @ KenniesNewName:
    I just keep it for worthless friends and families that don't do nothing
    Gift
  • Dark_Phoras @ Dark_Phoras:
    I have no idea what's happening with all my friends from other places
    Gift
  • KenniesNewName @ KenniesNewName:
    It's weird people in their mid 50s-20s seems to like social media more than TikTok and YouTube
    Gift
  • KenniesNewName @ KenniesNewName:
    Unless they get paid to upload videos
    Gift
  • Dark_Phoras @ Dark_Phoras:
    I used TikTok a couple of days and got tired
    Gift
  • Dark_Phoras @ Dark_Phoras:
    But it's still better than Facebook
    Gift
  • KenniesNewName @ KenniesNewName:
    One dude here swore I was trolling him on twitch and I never even used it
    Gift
  • Dark_Phoras @ Dark_Phoras:
    But that's a thing with social media; it creates an illusion of proximity, when in truth everyone is overwhelmed with all the information and all the social demands in the platforms
    Gift
  • Dark_Phoras @ Dark_Phoras:
    And a lot of people are addicted to the phone, checking social media or talking with someone. Some exercise in the gym while being glued to the phone, not even activity takes them away from it
    Gift
  • Dark_Phoras @ Dark_Phoras:
    And I was like that too, until I left social media. Now sometimes I'm grabbing my phone, opening the browser and thinking: I've seen everything I wanted to see, I don't have a reason to use the phone. And I put it down
    Gift
  • KenniesNewName @ KenniesNewName:
    I'd rather look at my phone than sit at a computer 24/7
    Gift
  • KenniesNewName @ KenniesNewName:
    Funnily when I'm out I hardly use my phone other than checking a message here and there
    Gift
  • KenniesNewName @ KenniesNewName:
    I'm mostly too busy making sure my neighbor doesn't get himself arrested
    Gift
  • Dark_Phoras @ Dark_Phoras:
    This evening two guys were speeding head first into my car in these:
    bolt-announces-a-custom-built-scooter-model-2-1024x536.jpg
    Gift
  • Dark_Phoras @ Dark_Phoras:
    I didn't make case, I made my manoeuver to park the car. But I caught them off-guard, the one ahead hit the brakes and had to jump from the scooter. For a second I thought he would go against the car. They were trying to race through a gap they perceived, thinking I was going to always drive forward
    Gift
  • Dark_Phoras @ Dark_Phoras:
    I guess they learned a valuable lesson, don't assume that real roads are a playground
    Gift
  • KenniesNewName @ KenniesNewName:
    I had a woman walk in the middle of the intersection once I was debating on flooring it
    Gift
  • Dark_Phoras @ Dark_Phoras:
    In those cases I honk
    Gift
  • KenniesNewName @ KenniesNewName:
    I need to get my uncle to install a cow horn
    Gift
  • Dark_Phoras @ Dark_Phoras:
    Those scooters go 40km/h, and the kids were riding them with no helmets
    Gift
  • Dark_Phoras @ Dark_Phoras:
    And trying to make for the gap like they're Millennium Falcon
    Gift
  • KenniesNewName @ KenniesNewName:
    Annoying can't find any type c to usb adapters in my place at least they're like $3
    Gift
  • KenniesNewName @ KenniesNewName:
    Sweet found one installing emudeck
    Gift
  • KenniesNewName @ KenniesNewName:
    Lol stupid ips is blocking rom sites time for a vpn
    Gift
    KenniesNewName @ KenniesNewName: Lol stupid ips is blocking rom sites time for a vpn