Tutorial  Updated

How to swap audio in Unreal Engine 4 games

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
114
Trophies
0
Age
42
XP
490
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
Developer
Joined
Oct 14, 2018
Messages
6,240
Trophies
3
XP
11,966
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
114
Trophies
0
Age
42
XP
490
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
Developer
Joined
Oct 14, 2018
Messages
6,240
Trophies
3
XP
11,966
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
24
XP
220
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,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Veho @ Veho:
    Mkay.
  • Veho @ Veho:
    I just ordered another package from China just to spite you.
  • SylverReZ @ SylverReZ:
    Communism lol
  • SylverReZ @ SylverReZ:
    OUR products
  • The Real Jdbye @ The Real Jdbye:
    @LeoTCK actually good quality products are dying out because they can't compete with dropshipped chinese crap
    +2
  • BakerMan @ BakerMan:
    @LeoTCK is your partner the sascrotch or smth?
  • Xdqwerty @ Xdqwerty:
    Good morning
  • Xdqwerty @ Xdqwerty:
    Out of nowhere I got several scars on my forearm and part of my arm and it really itches.
  • AdRoz78 @ AdRoz78:
    Hey, I bought a modchip today and it says "New 2040plus" in the top left corner. Is this a legit chip or was I scammed?
  • Veho @ Veho:
    @AdRoz78 start a thread and post a photo of the chip.
    +2
  • Xdqwerty @ Xdqwerty:
    Yawn
  • S @ salazarcosplay:
    and good morning everyone
    +1
  • K3Nv2 @ K3Nv2:
    @BakerMan, his partner is Luke
  • Sicklyboy @ Sicklyboy:
    Sup nerds
    +1
  • Flame @ Flame:
    oh hi, Sickly
  • K3Nv2 @ K3Nv2:
    Oh hi flame
  • S @ salazarcosplay:
    @K3Nv2 what was your ps4 situation
  • S @ salazarcosplay:
    did you always have a ps4 you never updated
  • S @ salazarcosplay:
    or were you able to get new ps4 tracking it \
    as soon as the hack was announced
  • S @ salazarcosplay:
    or did you have to find a used one with the lower firm ware that was not updated
  • K3Nv2 @ K3Nv2:
    I got this ps4 at launch and never updated since 9.0
  • K3Nv2 @ K3Nv2:
    You got a good chance of buying a used one and asking the seller how often they used or even ask for a picteof not updating just tell them don't update
    K3Nv2 @ K3Nv2: You got a good chance of buying a used one and asking the seller how often they used or even ask...