Cyberpunk 2077
0 of 0

File information

Last updated

Original upload

Created by

YG

Uploaded by

hgyi56

Virus scan

Safe to use

Tags for this mod

About this mod

This script is dedicated to modders that want to create legacy music mods. It allows the modder to retrieve all the music WEM files associated with a list of audio music events.

Permissions and credits
Changelogs
DESCRIPTION
This script is dedicated to modders that want to create legacy music mods. It allows the modder to retrieve all the music WEM files associated with a list of audio events.

You can now easily create a legacy audio mod that concerns music even if the game version changes. I will release another version of this script for "sfx_container.bnk" so you will be able to retrieve WEM files associated with sound effect events.

REQUIREMENTS
  • Python: v3.12.0, with lxml and jsonpath-ng libraries.

INSTALLATION
Put the python script
anywhere on your computer.
Be sure to install required python libraries by opening a cmd.exe:
pip install lxml jsonpath-ng

USAGE
The script takes 3 mandatory and 1 optional inputs:
  • [Optional] --wem=FOLDER_PATH


  • Optional argument to be used with --output if you want to copy relevant WEM files into an output folder.
    All musics are stored as WEM files located in the internal game path 'base\sound\soundbanks' next to OPUSPAK files.
    You need WolvenKit in order to extract these files from the game. Put all these WEM files into a folder. With game version 2.02 you have 4680 files.



  • --events_catalog=JSON_FILE_PATH

  • The game uses events in order to target a set of WEM files. An event is a human readable string.
    This is the entry point to any research about audio files. The events are listed in a catalog file located in the internal game path 'base\sound\event\eventsmetadata.json'.
    This file is a binary-encoded JSON file so you need WolvenKit in order to extract and convert it into readable JSON.



  • --xml=XML_FILE_PATH

  • Long story short: this is the path to 'cp_music.bnk.xml'.

    Full story:
    The game uses BNK (bank) files in order to organize and use WEM files which are stored either as standalone files or into OPUSPAK files. Thankfully for us, musics are stored as standalone files.
    There is one BNK file that concerns sound effects (sfx_container.bnk) and another that concerns musics (cp_music.bnk). These files are located in the internal game path 'base\sound\soundbanks'.

    You need WolvenKit in order to extract these files from the game.
    We will only use 'cp_music.bnk' since we want to work on music files.

    We need wwiser tool in order to convert the 'cp_music.bnk' into a XML readable file. Such tool is available here: https://github.com/bnnm/wwiser
    Once downloaded, also install the latest Python software including its optional components 'tcl/tk and IDLE' and 'pip'. I personally use Python 3.12.0 which is the latest at the moment (11/2023).

    Then open the wwiser folder (named wwiser-master) and execute the command 'py build.py' into a cmd.exe window so python will create an executable.
    The executable will be created in 'bin\wwiser.pyz'. You can then double-click on this file to open wwiser as a graphical interface.

    In the wwiser window, load the 'cp_music.bnk' file with the button [Load banks...] and wait for the process to finish. Then click on [Dump banks...] and wait for the XML file to be created (~68 MB).
    This is the XML file (cp_music.bnk.xml) you need to use here.



  • --events_to_lookup=TEXT_FILE_PATH

  • The text file that contains the list of events that you are interested in. You must put one event by line.
    Example: 'my_events_file.txt'

    == begin_file ==
    mus_ep1_ow_animals_combat
    mus_ep1_ow_arasaka_combat
    mus_ep1_ow_cyberpsycho_combat
    mus_ep1_ow_generic_combat
    mus_ep1_ow_militia_combat
    mus_ep1_ow_scav_combat
    mus_ep1_ow_technical_path_combat
    mus_ep1_ow_voo_doos_combat
    mus_mq002_scav_combat
    mus_mq003_militech_combat
    mus_mq013_zetatech_truck_03_combat
    mus_mq015_zetatech_truck_03_combat
    == end_file ==

    This script will give you all the WEM files associated with these events.
    So you can just do the rest of your work like changing audio, volume, muting... without the hassle of digging into the XML by yourself for days in order to find the relevant WEM files (which I did !).

    You may ask "How should I know the events to use here ?"
    You need to research in the 'eventsmetadata.json' file for keywords about what you are looking for.

    Example: if you want to look for combat music events, search for keywords like "_combat", "_police" or regular expressions: mus_.+_(combat|police).*





This script has 2 optional outputs. By default the script will output the results (events <> wem files) into the console.

  • [Optional] --output=FOLDER_PATH


  • Optionally copy the WEM files that match with the events from '--events_to_lookup' into this folder. Folder hierarchy will be created if necessary.



  • [Optional] --report=PATH


  • Optionally generates a JSON file that lists which events use which WEM files. If two events use exactly the same WEM files they will be put together separated with a comma.
    This report can be useful in order to share data with the community, or for you to know on which WEM files you have to work (for audio editing, etc).

    If you give a file path it will be used as is (and erased !). If you give a folder path it will create a 'events_report.json' into it.
    Folder hierarchy will be created if necessary.


SUPPORT

Feel free to contact me in case something does not work as expected so I can investigate.
Use the POSTS tab and describe your issue with as many details as you can.


MY MODS