DEV Community

Cover image for Guide - Audio Modding of "Arena of Valor"
Khang Nguyen
Khang Nguyen

Posted on

Guide - Audio Modding of "Arena of Valor"

I created this documentation first in Vietnamese, and published it on Notion. The mentioned game: "Arena of Valor" is a well-known MOBA game mostly in Southeast and East Asia, especially Vietnam, Thailand, and Taiwan.

I have done thorough research on how the audio system worked in this game, and I have successfully modified the background music in the main menu. I have posted several videos on Youtube as demonstration:

Mod nhạc Yorn Long Thần Soái Mod nhạc nền SAOxAOV v1
Yorn Long Thần Soái SAOxAOV v1

This Guide Will Cover

  • Changing the background music in the Arena of Valor lobby with any music that you want.
  • Modifying loop points (the timing of music repetition) to ensure the game replays your music at the correct timestamp.
  • Changing the background video.

This Guide Will Not Cover

  • Changing the game's login screen background music
  • Changing static images in the game. On lower-end systems, the lobby may display a static image instead of the background video

Prerequisites

Hardware Requirements

  • A Windows 64-bit computer - the Wwise software does not support 32-bit operating systems

Software Requirements

  • Tools

    • You can scroll down to the References section to download individual tools then organize them into the following file structure:

      AOV-AudioModdingTools
      ├───1 - Change audio
      │   │   extract.bat
      │   │   wwiseutil-gui.exe
      │   │
      │   ├───resources
      │   │       bnkextr.exe
      │   │       packed_codebooks_aoTuV_603.bin
      │   │       revorb.exe
      │   │       ww2ogg.exe
      │   │
      │   └───wav-to-wem
      │       │   convert.bat
      │       │   WsourcesMaker.exe
      │       │
      │       ├───input
      │       └───output
      └───2 - Edit loop point
              wwiser.pyz
              wwnames.db3
      

Implementation

I - Modifying Background Music

1. Obtaining Required Files

Navigate to the following path on your mobile device with Arena of Valor installed (this guide uses Vietnam version) and ensure you have downloaded all necessary resources: ./Android/data/com.garena.game.kgvn/files/Extra/2019.V2/Sound_DLC/Android
Note: the folder 2019.V2 will likely have its name changed because of game updates.

Retrieve these two files:

  • Holidayxx.bnk
    • xx represents the highest number among all "Holiday" files. This file contains the music; after each season, the game updates the music by adding a new "Holiday" file rather than replacing the old one. Currently, the game uses Holiday103.bnk, but this may change in future updates.
  • Music_Login.bnk
    • This file will be modified to adjust the loop point. Refer to section II - Adjusting Loop Points

Transfer these two files to your computer: drag the Holidayxx.bnk file into the 📁 1 - Change Audio folder, and similarly place the Music_Login.bnk file into the 📁 2 - Edit Loop Point folder:

For this section (I - Modifying Background Music), we will focus exclusively on the 📁 1 - Change audio folder

2. Extracting Audio (Optional)

We will extract audio from the Holidayxx.bnk file to verify that we have selected the correct file for modification

Open the 📁 1 - Change audio folder and ensure the folder structure matches the following:

Explanation:

  • The 📁 resources folder contains tools for extracting audio from Holidayxx.bnk. The image shows the contents of this folder
  • The 📁 wav-to-wem folder is a helper utility to convert .wav files to .wem format
    • This guide does not include instructions for this tool, but I will link to the original thread which contains detailed usage instructions. It will be more convenient than the manual method I describe below. Please refer to the 📖 References section at the end of this guide.
  • extract.bat is a script I created for convenient extraction of .bnk files - You can right-click the file → Edit to view the source code
  • wwiseutil-gui.exe is the application we will use to modify audio

The image on the right shows the contents of the 📁 resources folder. You can download these files from the 📖 References section if the tool link is unavailable.

→ To extract audio, drag the Holidayxx.bnk file onto the extract.bat script. A file with .ogg extension will automatically appear. Example:

Play the .ogg file and verify that it matches the current game music. If it does, use this "Holiday" file for modification; otherwise, try another file.

3. Converting Your Music to the Correct Format

To import audio into the game, we must convert it to .wem format, which is not a standard audio format but rather Audiokinetic's Wwise proprietary audio format (WEM stands for Wwise Encoded Media). To replace audio in a .bnk file, we can only use .wem files

Assuming you have an .mp3 audio file and want to modify it into the game.

→ The steps you need to follow are to convert the file to .wav format and then to .wem format (see the illustration below)

To convert .mp3 and other audio formats to .wav, you can use this website by Alexander Blk: https://alexiii.github.io/web-wav-converter/ or search for other alternatives

→ After converting to .wav format, we will now convert to .wem.

Converting .wav to .wem:

  • 1. Open Wwise through Wwise Launcher

    Install the Wwise Launcher and log in with your Audiokinetic account. Go to the "Wwise" tab in the left sidebar and install your desired Wwise version. I use version 2018.1.11

    Once installation is complete, click the "Launch Wwise" button to open Wwise

  • 2. Create a New Project (project name is not important)

  • 3. Modify Conversion Settings to Vorbis High Quality

  • 4. Add .wav File to Project

  • 5. Convert File to .wem Format

    → Wait a moment for the conversion to complete

  • 6. Retrieve the Converted .wem File

    After clicking "Open Containing Folder", Windows File Explorer will open to the project directory. Navigate to the following path to locate the .wem file: .cache/Windows/SFX

4. Modifying the Holiday File

Return to the 📁 1 - Change audio folder:

  • Rename the Holidayxx.bnk file and add the _bak suffix as shown:
    • This prevents conflicts when saving the modified file with the original name

  • Open wwiseutil-gui.exe
  • Click "Open" and load the Holidayxx_bak.bnk file

  • Select the existing audio file and click "Replace"

  • Replace it with the .wem file we just converted

  • Save the file with the original Holiday filename

Completion

  • Holiday103_bak.bnk is the original unmodified file
  • Holiday103.bnk is the file with modified audio (the modded file)

→ You can now replace the original Holiday file in the game directory with this modified version, and the game will use your audio. Give it a try ;)

II - Adjusting Loop Points

If you have successfully completed the audio modification, congratulations 🎉, but we are not quite finished. If your replacement audio file has a different duration than the original game audio, you will notice that the game will repeat the audio at an incorrect time. Instead of the game looping immediately after your audio ends, it will loop after the original audio duration.

The game relies on a value stored in the Music_Login.bnk file. This file contains values related to playback management for certain game audio files (such as playlist config, flags & controls, etc., and importantly for this guide, the playback duration).

We will now modify the Playback Duration value in this file so the game loops your audio at the precise moment you desire.

1. Obtaining Required Files

Return to the 📁 1 - Audio Replacement folder and copy the Holidayxx_bak.bnk file into the 📁 2 - Edit Loop Point folder

→ Open the 📁 2 - Edit Loop Point folder and ensure it matches the following image:

  • Holiday103_bak.bnk is the original Holiday file (unmodified) that we just copied; we will use this file to identify the information we need to change
  • Music_Login.bnk as I explained above
  • wwiser.pyz is the tool we will use to extract information from the Music_Login.bnk file

If it does not match or files are missing, please review section **I - Modifying Background Music**

2. Extracting Information from the Holiday File

Ensure that your machine has Python installed

Make sure you are in the 📁 2 - Edit Loop Point folder, click on the address bar and type cmd then press Enter. See the GIF below for reference:

Once the Command Prompt window appears, type the following command: python wwiser.pyz Holidayxx_bak.bnk. See the GIF below:

You will notice a new file appears with the .xml extension

→ Use any text editor and open this .xml file. I use Notepad++

Search for the keyword fSrcDuration

→ Copy this value. In the case of my Holiday103 file, the value is 258000 (we do not include decimal places). This value represents the audio duration in milliseconds; 258000 milliseconds equals 4 minutes and 13 seconds.

3. Modifying Loop Points Using Hex Editor

Now we understand that the game will loop the audio in the lobby after every 258000 milliseconds (4 minutes and 13 seconds), regardless of what audio the game is currently playing. We will now edit this value in the Music_Login.bnk file, because this file contains the information that helps the game handle playback for certain game audio.

3.1. Calculate Duration for Your Music

We need to calculate the duration of your music and convert it to milliseconds. Suppose my music file is: JJBA Stone Ocean: Jolyne Theme (Full Version) | EPIC HQ COVER

The music is exactly 4 minutes long. I want the game to play the music until the end and pause for 2 seconds before playing again. That is 240000 milliseconds (4 minutes of music) + 2000 milliseconds (2 seconds of delay) = 242000

I will change the original value 258000 (4 minutes 13 seconds) to 242000 (4 minutes 2 seconds) as an example.

3.2. Implementation

Ensure you have a Hex Editor. I use HxD (free), or alternatively 010 Editor (paid).

Open the Music_Login.bnk file in your Hex Editor.

→ You will need to replace all values of type Double because this value is stored by the game as a floating-point number. See the image for reference:

  1. Select "Floating point number"
  2. In "Search for", enter the fSrcDuration value from the Holiday file we just found; in "Replace with", enter the value you calculated
  3. Select type as Double
  4. Check "Replace All"

→ After completing the replacement, simply save the file and copy it back to the ./Android/data/com.garena.game.kgvn/files/Extra/2019.V2/Sound_DLC/Android folder on your phone. It is recommended to backup the original file

III - Changing Background Video

The audio part is done! If you want, you can change the background video as well!

You can do this by navigating to the following path on your phone: ./Android/data/com.garena.game.kgvn/files/Extra/2019.V2/ISPDiff/LobbyMovie

And find the .mp4 file that matches the background video the game is currently using. Then replace that mp4 file with any video of your choice!

📖 References

Tools

  • extract.bat source code:

    @echo off
    setlocal enabledelayedexpansion
    
    rem Get the name of the dragged file
    set "draggedFile=%~1"
    
    rem Check for existence
    if not exist "%draggedFile%" (
        echo File does not exist.
        pause
        exit /b
    )
    
    rem Set path
    set "resourcesFolder=resources"
    
    rem Set the name of bnkextr.exe
    set "bnkextr=bnkextr.exe"
    
    rem Set the names of the other tools
    set "ww2ogg=ww2ogg.exe"
    set "packedCodebooks=packed_codebooks_aoTuV_603.bin"
    set "revorb=revorb.exe"
    
    rem Get parent folder
    for %%A in ("%draggedFile%") do (
        set "parentFolder=%%~dpA"
        set "draggedFileName=%%~nxA"
    )
    
    rem Run bnkextr.exe with /nodir flag
    "%resourcesFolder%\%bnkextr%" "%draggedFile%" /nodir
    
    rem Process .wem files using ww2ogg.exe
    for %%F in ("%parentFolder%\*.wem") do (
        "%resourcesFolder%\%ww2ogg%" "%%~F" --pcb "%resourcesFolder%\%packedCodebooks%"
    )
    
    rem Process .ogg files using revorb.exe
    for %%F in ("%parentFolder%\*.ogg") do (
        "%resourcesFolder%\%revorb%" "%%~F"
    )
    
    rem Delete the original .wem files
    for %%F in ("%parentFolder%\*.wem") do (
        del "%%~F"
    )
    
    echo Processing complete.
    exit
    
  • eXpl0it3r. (2023, February 13). bnkextr. https://github.com/eXpl0it3r/bnkextr

Software

Relevant Resources

Top comments (0)