Cyberpunk 2077
0 of 0

File information

Last updated

Original upload

Created by

YG

Uploaded by

hgyi56

Virus scan

Safe to use

65 comments

  1. Ravenlash
    Ravenlash
    • member
    • 16 kudos
    Any assistance with the below please?

    D:\Program Files (x86)\GOG Galaxy\SoundFX Search and Update>python soundfx_search_and_update.py --events_catalog="eventsmetadata.json" --events_to_lookup="events_to_lookup.txt" --xml="D:\Program Files (x86)\GOG Galaxy\SoundFX Search and Update\xml"
    Loading cp_music.bnk.xml... Done
    Loading sfx_container.bnk.xml... Done
    Loading events_to_lookup.txt... Done
    Loading eventsmetadata.json... Done
    Processing event 0%: ui_phone_sms
    Traceback (most recent call last):
      File "D:\Program Files (x86)\GOG Galaxy\SoundFX Search and Update\soundfx_search_and_update.py", line 945, in <module>
        sourceIDs = last_used_parser.resolve_node(last_used_parser.tree.getroot(), event_wwise_id)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'NoneType' object has no attribute 'resolve_node'

    Don't have a clue in how to fix this..

    EDIT: Fixed this by using your XML files, it seems the XML files exported from WolvenKit are causing issues with the tool.
    1. hgyi56
      hgyi56
      • premium
      • 64 kudos
      The only way to generate the xml files is written in the description page. 
    2. Ravenlash
      Ravenlash
      • member
      • 16 kudos
      I did generate them according to the description page, however it seemed that the python script still failed in using the generated XML files - it only uses the XML files that you uploaded on Nexus. I am just informing you of what is happening.
    3. hgyi56
      hgyi56
      • premium
      • 64 kudos
      Apparently you did not exactly generate the XML as needed. I have just generated, tested and uploaded the files for v2.12 you can download them from the optional files section.
    4. Ravenlash
      Ravenlash
      • member
      • 16 kudos
      I swear I followed the guide to the letter.... thank you.
  2. PezntDestroyer
    PezntDestroyer
    • premium
    • 0 kudos
    Sorry, really new to python. I can't get this to work. I installed and set up everything correctly, that I am sure of, but I don't know how to specify the paths to the required files. I tried scouring the code for any clues as to how to troubleshoot it, and when I ran it in IDLE, it gave me this:

    Missing parameter for argument: --events_catalog
    Missing parameter for argument: --xml
    Missing parameter for argument: --events_to_lookup

    I suspect the answer may be revealed with the additional argument help cmd prompt, but alas... I can't get that to work either. lol SMH

    Any insight is appreciated.
    1. hgyi56
      hgyi56
      • premium
      • 64 kudos
      This is a simple command line tool. Just like you would run an EXE file with arguments.
      You must call it this way either from a command prompt window of from a IDE with run configurations:

      py soundfx_search_and_update.py --events_catalog="path/to/file" --xml="path/to/folder" --events_to_lookup="path/to/file"... and so on.

      Into an IDE you would generally have a text field to write all arguments at once: --events_catalog="path/to/file" --xml="path/to/folder" --events_to_lookup="path/to/file"...

      And another box or text field to select the Python script.
    2. PezntDestroyer
      PezntDestroyer
      • premium
      • 0 kudos
      Wow ok i got it. Kudos for the quick response! Thank you! And yes, I do feel stupid now; absolutely did not put quotation marks around any of the file paths...
    3. hgyi56
      hgyi56
      • premium
      • 64 kudos
      Quotes are required when your path contains spaces. Because in a command prompt the space character is used to separate elements.
    4. PezntDestroyer
      PezntDestroyer
      • premium
      • 0 kudos
      Sir or ma'am, you put up a donate button RIGHT... NOW! ...Either that or give me your PayPal. You deserve something more than my undying gratitude. You just opened a whole other universe to me.
    5. hgyi56
      hgyi56
      • premium
      • 64 kudos
      Haha thank you for your message ! My rewards are people satisfied with my mods. :)

      Other than Donation Points on Nexusmods that may allow me to buy a key for Phantom Liberty some day; I don't have anything for donation. I don't really care to get more money doing mods. But thank you again. =D

      I'm glad you can have fun with this tool !
    6. CorvusNoise
      CorvusNoise
      • member
      • 0 kudos
      I don't understand this... I have pasted these in the command prompt and nothing has worked...
    7. hgyi56
      hgyi56
      • premium
      • 64 kudos
      Did you install python and update the PATH variable during installation so you can call « py » ?
  3. Guitarmageddon
    Guitarmageddon
    • supporter
    • 2 kudos
    Whenever I try to update OPUSpaks and OPUSINFO with my modified wav file, I get this error:

    "Error during conversion of D:\CP77 Modding tools\SoundFX Search and Update\audio folder\728608401.wav into OPUS:
    b'Error parsing input file: D:\\CP77 Modding tools\\SoundFX Search and Update\\audio folder\\728608401.wav\r\n'

    This only happens with the modified .wav file, running this with the original .wav file works fine.
    Does the audio file have to be the same length as the original, or have to adhere to a file size limit?
    1. hgyi56
      hgyi56
      • premium
      • 64 kudos
      There is no such restriction maybe you did not encode the WAV file with the right settings. Try with something like PCM 16-bit 48kHz. 

      When I use Audacity to modify a WAV file I export it with the default settings.
    2. Guitarmageddon
      Guitarmageddon
      • supporter
      • 2 kudos
      YES THAT WAS IT! Thanks
      Yeah, I exported it from FL Studio as an MP3 and then just renamed it to a WAV to save file space as it's a long file
      I just remade it and it worked fine :D
    3. hgyi56
      hgyi56
      • premium
      • 64 kudos
      You cannot rename a mp3 file into wav because the data is not encoded the same way. The mp3 is lossy this is why it is much smaller than wav.

      Even if you rename the file into wav, the data is still mp3. 

      I’m glad you could solve your issue.
  4. midoman
    midoman
    • member
    • 5 kudos
    same error to me...

    raise Exception(f'Unable to resolve element {node_type}[id={identifier}] from parent {parent_node.get('na')}')
                                                                                                               ^^
    SyntaxError: f-string: unmatched '('


    why this happend? using correct CMD.exe but error comes up

    python istalled, pip and requirements all installed but that happen
    1. hgyi56
      hgyi56
      • premium
      • 64 kudos
      Are you using a folder path of a file path for the "xml" argument ?
      Paste your full command line here so I can tell you if it is correct.
  5. BitBaron
    BitBaron
    • premium
    • 0 kudos
    I double click on the .py file and there is a black box for an instant but then dissapears, please make a full video instruction or a simpler tool

    When I drag the PY script onto a CMD window it gives:
      File "F:\CP2077_MOD\soundfx_search_and_update.py", line 119
        raise Exception(f'Unable to resolve element {node_type}[id={identifier}] from parent {parent_node.get('na')}')
                                                                                                               ^^
    SyntaxError: f-string: unmatched '('
    1. hgyi56
      hgyi56
      • premium
      • 64 kudos
      Hey, like I said below to another comment you should use this tool as a regular command-line tool. Open a "cmd.exe" window then enter the command from the tool's folder. The first line is to get into the folder and the second line calls the tool with arguments.

      dir "/path/to/SoundFX Search and Update/"
      py soundfx_search_and_update.py --events_catalog="path/to/file" --xml="path/to/folder" --events_to_lookup="path/to/file"... and so on with the other arguments you want to use.
    2. BitBaron
      BitBaron
      • premium
      • 0 kudos
      Can this tool convert the WEM files to english, that's what I need, something that will convert them to their actual sound file names, e.g. take "0001.WEM" and convert it to q307_sc_01_av_door_open_ext.wav or something. Essentially convert the wwiseId or the wems into something that is either the NAMED sound file, or that tells me which sound name is which WEM file.

      Can this tool do that? Don't want to waste time if it can't make the sounds a readable format.
    3. hgyi56
      hgyi56
      • premium
      • 64 kudos
      This tool will copy the WEM files and convert them to WAV. Their names will be their source ID. 

      You have the correspondence of sourceID to event names in the console output and in the report file if you use the --report argument. 
  6. gilrond
    gilrond
    • member
    • 0 kudos
    Hi!

    I'm trying to read your script to do things a bit more manually, but I'm a bit confused still.

    Basically, I had this goal - find the tracks for Roach Race game.

    So I managed to extract eventsmetadata.json file, that has this wwise id for mus_roach_race_kaer_morhen track: 1425589070.

    Then I extracted cp_music.bnk into xml and found this action id 920637579 that matches wwise id 1425589070 (it's listed as CAkEvent).

    I found also something related as idExt = 2080174084

    How do I go from 920637579 or 2080174084 to finding correct wem or opuspak file? I.e. where is that mapping stored or how do I calculate it (I didn't get that from your script yet).

    Thanks!
    1. hgyi56
      hgyi56
      • premium
      • 64 kudos
      You are trying to create a copy of what my tool already does.
      The tool will follow the links down to all source IDs (audio files).

      If you look at xpath queries you will find the path. But why not just execute the tool ?
    2. gilrond
      gilrond
      • member
      • 0 kudos
      I had some problems with running it (I'm on Linux). Plus I'm interested in understanding how to calculate the name of the file given just the source of the game resources.

      What do you mean by xpath queries, something defined in the XML?

      I guess I can reconstruct it backwards. For example I found one of the wem files in the XML:

      <fld ty="tid" na="sourceID" va="1009571067"/>

      So they do reference actual IDs. But how does it work in case of opuspak's for example?

    3. hgyi56
      hgyi56
      • premium
      • 64 kudos
      There is a python class that parses XML using Xpath queries to follow the links. 
      You need to understand Xpath but its not that difficult. 
    4. gilrond
      gilrond
      • member
      • 0 kudos
      I see, thanks. Going backwards I see that both wem ids and opuspaks ids are referenced in the XML, so it must be connected there. I'll dig a bit more into XML itself.

      Though I'm not sure if those ids are actually opuspaks ones.

      I guess I need to understand better the chain of id identifiers to trace.

      Like I got that idExt, but I'm not sure what to do with it.
    5. hgyi56
      hgyi56
      • premium
      • 64 kudos
      If the source ID refers to a WEM file then simply pick it from the soundbanks folder. 

      Otherwise it is a OPUS file contained into a Opuspak file. In this case you need to extract the OPUS data from the opuspak. 

      My tool does all this job too. 
      Maybe you can tell me what goes wrong on Linux when you run the tool ?
    6. gilrond
      gilrond
      • member
      • 0 kudos
      Yeah, I figured, but I didn't get to sourceID part even. In my example above:

      In JSON:

       "redId": {
      "$type": "CName",
      "$storage": "string",
      "$value": "mus_roach_race_kaer_morhen"
       },

      So I use: mus_roach_race_kaer_morhen which corresponds to

      "wwiseId": 1425589070

      So I look up that and get:

       <obj na="CAkEvent" ix="13634">
       <fld ty="u8" na="eHircType" va="4" vf="0x04 [Event]"/>
       <fld ty="u32" na="dwSectionSize" va="9" vf="0x09"/>
       <fld ty="sid" na="ulID" va="1425589070"/>
       <obj na="EventInitialValues">
       <fld ty="var" na="ulActionListSize" va="1"/>
       <lst na="actions" co="1">
      <obj na="Action" ix="0">
       <fld ty="tid" na="ulActionID" va="920637579"/>
      </obj>
       </lst>
       </obj>
       </obj>



      If I keep searching using let's say ulActionID: 920637579

      I get a another node like

       <obj na="CAkActionSetSwitch" ix="13633">
      <fld ty="u8" na="eHircType" va="3" vf="0x03 [Action]"/>
      <fld ty="u32" na="dwSectionSize" va="26" vf="0x1A"/>
      <fld ty="sid" na="ulID" va="920637579"/>
      <fld ty="u16" na="ulActionType" va="6401" vf="0x1901 [SetSwitch]"/>
      <obj na="ActionInitialValues">
       <fld ty="tid" na="idExt" va="2080174084"/>
       <fld ty="u8" na="idExt_4" va="0" vf="0x00">
       <fld ty="bit0" na="bIsBus" va="0"/>
       </fld>
       <obj na="AkPropBundle<AkPropValue,unsigned char>">
       <fld ty="u8" na="cProps" va="1"/>
       <lst na="pProps" co="1">
      <obj na="AkPropBundle" ix="0">
       <fld ty="u8" na="pID" va="15" vf="0x0F [DelayTime]"/>
       <fld ty="uni" na="pValue" va="500"/>
      </obj>
       </lst>
       </obj>
       <obj na="AkPropBundle<RANGED_MODIFIERS<AkPropValue>>">
       <fld ty="u8" na="cProps" va="0"/>
       <lst na="pProps" co="0"/>
       </obj>
       <obj na="SwitchActionParams">
       <fld ty="tid" na="ulSwitchGroupID" va="1338466608"/>
       <fld ty="tid" na="ulSwitchStateID" va="2080174084"/>
       </obj>
      </obj>
        </obj>

       
      But I didn't get to soure ID, so I'm not sure I'm doing the right thing.
    7. hgyi56
      hgyi56
      • premium
      • 64 kudos
      I don’t have the code with me right now but the parsing rules are defined in Xpath queries. 

      Simply look at them to understand the path.
    8. gilrond
      gilrond
      • member
      • 0 kudos
      Running the script like this gives an error:

      python3 soundfx_search_and_update.py --events_catalog eventsmetadata.json.json --events_to_lookup events.txt --xml cp_music.bnk.xml

      raise Exception(f'Unable to resolve element {node_type}[id={identifier}] from parent {parent_node.get('na')}')
        ^^
      SyntaxError: f-string: unmatched '('
    9. gilrond
      gilrond
      • member
      • 0 kudos
      About xpath, I assume you mean this (since this is defiend as CAkEvent):

           def find_CAkEvent_ulActionIDs(self, parent_node, identifier):
              source_ids = set()

              nodes = parent_node.findall("./obj[@na='EventInitialValues']/lst[@na='actions']/obj[@na='Action']/fld[@na='ulActionID']")
              if not nodes:
                  print(f'CAkEvent[id={identifier}] has an empty list of actions, therefore the event has no audio file associated')
                  return {0}

              for node in nodes:
                  source_ids.update(self.resolve_node(parent_node, node.get('va')))

              return source_ids

      So that means it will return id 920637579 I mentioned above. But there is no wem if like that. So it means it's one of the opuspaks? How do I match that to the correct one?

      I'll try reading your opus related code.
    10. hgyi56
      hgyi56
      • premium
      • 64 kudos
      This tool shall definitely work with Linux as this is only python.
      Use arguments like this: - -events_catalog=/path/to/eventsmetadata.json.json
      With quotes around the path. 

      And the xml argument must be a folder containing xml files. 
    11. gilrond
      gilrond
      • member
      • 0 kudos
      Hm, I guess opusinfo is their database of what's in opuspaks? I'll try to write a simple tool to extract that info.
    12. gilrond
      gilrond
      • member
      • 0 kudos
      Same error. I have python 3.11.7 for the reference (Debian testing). May be it's 3.12 specific?
  7. aalexbug
    aalexbug
    • premium
    • 297 kudos
    you known if is possible to change the sound of the car?
    1. hgyi56
      hgyi56
      • premium
      • 64 kudos
      I guess this is possible. If I am correct the famous mod called « Let There Be Flight » seems to do this with a flying car that sounds like an AV.

      I cannot guarantee that my tool allows to change a vehicle sound. I didn’t create this tool to do this. This is more about general purpose that will suit 90% of sound modding. 

      There are still specific sounds like vehicles that may work a bit differently.
  8. Aexhell
    Aexhell
    • member
    • 0 kudos
    When I try to extract to extract events, I get this error: 



    Do you know what could be causing it?
    1. hgyi56
      hgyi56
      • premium
      • 64 kudos
      Not sure what causes this, I have just tried the "ui_menu_loop_01_start" event and it worked.
      Check that you are using all game files from the same game version.

      Download the latest tool version too.
      Can you give me all the events you wanted to look for ?
    2. Aexhell
      Aexhell
      • member
      • 0 kudos
      Found the solution, instead of try and extract it with WolvenKit I downloaded your XML files and events catalog and it worked! Now I only have to edit the sound event's duration.
    3. hgyi56
      hgyi56
      • premium
      • 64 kudos
      I am not sure that you can modify this. It seems to be stored into the BNK file and as far as I know there no way to edit this file.
  9. DanteUniversal
    DanteUniversal
    • member
    • 1 kudos
    This is weird even jsonpath_ng is installed in cmd give me this error

    Traceback (most recent call last):
      File "C:\SoundFX_Search_and_Update\soundfx_search_and_update.py", line 3, in <module>
        import jsonpath_ng.ext as jp
    ModuleNotFoundError: No module named 'jsonpath_ng'
    1. hgyi56
      hgyi56
      • premium
      • 64 kudos
      You may be using the wrong python interpreter if you have multiple python installed. Check the python version you are using with "py --version" and "where python" to check the path of python. Check installed libraries using "pip freeze".

      Install this library using a '-' character: pip install jsonpath-ng
    2. DanteUniversal
      DanteUniversal
      • member
      • 1 kudos
      Tried to uninstall python and deleted files in appdata
      restarted the system
      reinstalled python-3.12.1-amd64.exe
      restarted again
      reinstalled packages with pip install lxml numpy jsonpath-ng how you written in the guide
      restarted again

      C:\WINDOWS\system32>py --version
      Python 3.12.1

      C:\WINDOWS\system32>where python
      C:\Users\Dante\AppData\Local\Microsoft\WindowsApps\python.exe

      C:\WINDOWS\system32>pip freeze
      jsonpath-ng==1.6.0
      lxml==4.9.3
      numpy==1.26.2
      ply==3.11

      result: same issue ModuleNotFoundError: No module named 'jsonpath_ng'

      I consider the idea to format the ssd.

    3. hgyi56
      hgyi56
      • premium
      • 64 kudos
      Try replacing "py" or "python" command call with the full path from "C:\Program Files\Python312\python.exe" (or whatever exact path you have at this location).
    4. DanteUniversal
      DanteUniversal
      • member
      • 1 kudos
      Oh God Thank You very much finally it works, tried for an entire afternoon.
      And extracted .wav files too.

      Spoiler:  
      Show
    5. hgyi56
      hgyi56
      • premium
      • 64 kudos
      Nice ! What was the issue then ?
    6. DanteUniversal
      DanteUniversal
      • member
      • 1 kudos
      Uninstall python is not enough, you need to delete a path in Environment Variable Window like this "C:\Users\Dante\AppData\Local\Programs\Python\Python312\".
      After you delete the path reboot the pc and install Python again and it works.
  10. NIKITI4ZET
    NIKITI4ZET
    • member
    • 0 kudos
    please make a video guide on how to work with this
    1. hgyi56
      hgyi56
      • premium
      • 64 kudos
      Could you tell me what you find difficult exactly ?
    2. NIKITI4ZET
      NIKITI4ZET
      • member
      • 0 kudos
      I would like a video full video guide from start to finish of working with this utility, like on the Wolwen Kit website
    3. hgyi56
      hgyi56
      • premium
      • 64 kudos
      Looking at the pictures on the main page should be enough for you to use the script.
      You have the input arguments and below the images you have the description of each argument.
    4. BitBaron
      BitBaron
      • premium
      • 0 kudos
      It's not.

      Imagine someone just getting into modding with no Python experience. The diagrams don't mean anything to anyone other than their creator and maybe some python veterans.
    5. hgyi56
      hgyi56
      • premium
      • 64 kudos
      You are right, in fact I mostly address this tool to people familiar with command-line tools and a bit of Cyberpunk modding because this tool requires using WolvenKit and extracting files from the game to feed this tool.