/AudioExporter

Export WAV audio files from VALORANT

Primary LanguagePythonMIT LicenseMIT

AudioExporter

AudioExporter is a Python 3.8 script that extracts VALORANT's audio files into a playable WAV files. There are four types of exports supported by AudioExporter:

  1. .ubulk files containing WEM content.
  2. .uexp files when a .ubulk is expected but doesn't exist.
  3. .uasset files that contain references to audio files.
  4. Exporting based on audio ID.

Package usage

Installation

pip install git+https://github.com/NotToDisturb/AudioExporter.git#egg=AudioExporter

The following tools are also required:

  1. UModel
  2. vgmstream

Documentation


AudioExporter(pak_language: str, folder_language: str, game_path: str = None)

Creates an instace of AudioExporter, loading the config. If game_path is provided, it should be a path to a VALORANT-Win64-Shipping.exe, see more in Example paths.

Check the Config file section and the ConfigLoader repo to learn more about how the config file works.


<AudioExporter instance>.export_audios(

    files: list, audio_types: list = ["localized"], audio_paks_path: str = None,
    output_path: str = None, archive=False
)

Exports and parses files by searching in each provided audio_types directory. It directs each file to its appropriate exporter based on the file extension.

  • If provided, audio_paks_path will override the VALORANT path (valorant_path in the config)
  • If provided, output_path it will override the output path (output_path in the config)
  • If true, archive also copies the resulting WAV file to an archival path. See more in the Archiving section.

Read more about audio_types.


<AudioExporter instance>.export_ubulk(

    file: str, output_path: str = None, parent: str = None, archive: bool = False )

Parses a ubulk file by running it through vgmstream (vgmstream_path in the config).

  • If provided, output_path it will override the output path (output_path in the config)
  • If provided, parent overrides the default ubulk parent.
  • If true, archive also copies the resulting WAV file to an archival path. See more in the Archiving section.

<AudioExporter instance>.export_uexp(

    file: str, output_path: str = None, parent: str = None, archive: bool = False )

Parses a uexp file by converting it to ubulk and running it through vgmstream (vgmstream_path in the config).

  • If provided, output_path it will override the output path (output_path in the config)
  • If provided, parent overrides the default uexp parent.
  • If true, archive also copies the resulting WAV file to an archival path. See more in the Archiving section.

<AudioExporter instance>.export_id(

    audio_id: str, audio_type: str, audio_paks_path: str = None,
    output_path: str = None, parent: str = None, archive: bool = False
)

Finds and exports audio_id from the given audio_type folder and parses by ensuring it is ubulk and running it through vgmstream (vgmstream_path in the config).

  • If provided, audio_paks_path will override the VALORANT path (valorant_path in the config)
  • If provided, output_path it will override the output path (output_path in the config)
  • If provided, parent overrides the default audioID parent.
  • If true, archive also copies the resulting WAV file to an archival path. See more in the Archiving section.

Read more about audio_types.


<AudioExporter instance>.export_uasset(

    file: str, audio_type: str, audio_paks_path: str = None,
    output_path: str = None, parent: str = None, archive: bool = False
)

Finds and exports all audio ids present in file from the given audio_type folder and parses by ensuring it is ubulk and running it through vgmstream (vgmstream_path in the config).

  • If provided, audio_paks_path will override the VALORANT path (valorant_path in the config)
  • If provided, output_path it will override the output path (output_path in the config)
  • If provided, parent overrides the use of file's filename as parent.
  • If true, archive also copies the resulting WAV file to an archival path. See more in the Archiving section.

Read more about audio_types.


<AudioExporter instance>.find_ids(file: str, audio_type: str) -> list

Returns a list with all the audio ids of audio_type in file. Read more about audio_types.



Config file

AudioExporter uses a configuration file to know where the needed tools and other paths are:

Path Validation type Description
umodel_path File Path to the UModel executable.
vgmstream File Path to the vgmstream executable.
aes_path: File Path to the AES key, a text file containing only the key in 0x<key> format.
valorant_path Folder Path to your VALORANT installation folder. See more on Example paths.
working_path Folder Path where the extraction of audio files and its parsing to WE; will take place.
output_path Not empty path Path where the parsed WAV files will be placed. Check out the available output path keywords.

Audio types

Type Description
localized Audios that are present in /Game/WwsiseAudio/Localized/{folder_language}/Media/
general Audios that are present in /Game/WwsiseAudio/Localized/Media/

Example paths

Found in Path Example
Code game_path C:\Riot Games\VALORANT\live\ShooterGame\Binaries\Win64\VALORANT-Win64-Shipping.exe
Code audio_paks_path C:\Riot Games\VALORANT\live\ShooterGame\Content\Paks\
Config valorant_path C:\Riot Games\VALORANT\live\

Output path keywords

Keyword Description
{pak_language} Replaced by the language of the audio file in xx_YY format.
{folder_language} Replaced by the language of the audio file in xx-YY format.
{game_version} Replaced by the game version on the provided executable.
{audio_id} Replaced by the string of numbers identifying the audio in the game files.
{parent} Replaced by one of four when a parent argument is not provided:
  1. ubulk for .ubulk exports.
  2. uexp for .uexp exports.
  3. audioID for exports using the audio id.
  4. The name of the file that refers to the audio for .uasset exports.

Example usage

Here is an example of how to use AudioExporter:

from audioexporter import AudioExporter

NATURES_WRATH = "C:\\ProgramFiles\\UModel\\Saves\\Game\\WwiseAudio\\Localized\\en-US\\Media\\324031775.ubulk"

exporter = AudioExporter("en_US", "en-US")
exporter.export_files([NATURES_WRATH])

The first time this script is run, it will exit after generating audio_config.json. Subsequent runs will continue exiting until the configuration file is filled out correctly. Once it is, the script will execute properly and the exported audio files will be in the output path (output_path in the config).

Archiving

AudioExporter features an archival feature that allows the user to automatically archive every audio file exported. The first time a script that uses AudioExporter is run with archive=True, a new config file will be generated within the installation path of AudioExporter (shown by the script upon generation).

That configuration can be identical to the one in your project folder, but in order to not overwrite audio files from other versions, it is recommended that the filename of the path in output_path be {parent} - {audio_id} - {folder_language}-{game_version}.wav

Standalone usage

It is also possible to use AudioExporter as a standalone script:

  1. Download the latest release
  2. Extract the zip file
  3. Open a console inside the extracted folder
  4. Install the required packages using pip install -r requirements.txt
  5. Run the script using python audioexporter.py

In the first execution, the config file is created and needs to be filled out. Check out Installation for the tools required and Config file for more details on how to fill out the config.
Running the script after filling out the config, you will be asked for a list of files. Once inputted, the audio files will be exported.