Baldur's Gate 3

File information

Last updated

Original upload

Created by

Tendirty

Uploaded by

Tendirty

Virus scan

Safe to use

About this mod

Guide on how to replace vanilla audio files in Baldur's Gate 3 with custom music, and Guide on .wem Files.

Permissions and credits
Donations
IMPORTANT EDIT AFTER PATCH 5.0 (NOVEMBER 30, 2023) AND BEYOND: It has come to my attention that BG3 may have changed the compression format for all .wem files from WEM OPUS to VORBIS. When you're creating your .wem files or converting your audio files back to .wem files using WWise, try VORBIS instead of WEM OPUS, and try each compression format if that doesn't work, otherwise your file will be silent. Refer to paragraph How to convert .wem files into listenable audio files: for more information.

I found the ID's for the .wem files that are responsible for the Battle Music in Baldur's Gate 3. I'm not a big proponent of keeping information to myself and refusing to help others, so I'm sharing what I've found out in order to save hours for other people as well as explain (in extensive detail) how to replicate the process, in hopes of providing a guide for future mods which will only serve to benefit the community.

There are youtube videos (not made by me), that are fast and easy to understand, which are linked at the bottom in my "Thanks and Acknowledgements" section. You can use my guide as supplementary for the videos, or vice-versa. The pace is to your choosing, and if I have too much hand-holding for your liking, then feel free to watch the videos first.


Installation Guide:

The goal is to copy the .wem files in the mod to the directory Baldurs Gate 3\Data\Public\Shared\Assets\Sound, which is located in the Main BG3 folder ex: C:\Program Files (x86)\Steam\steamapps\common\Baldurs Gate 3 (not in AppData). If this directory does not already exist, then create them yourself by adding new folders within new folders until you get to the last Sound folder. Alternatively, you can simply paste the "Data" folder from the Main File of the mod "ExampleReplacementFilesAndGuide" into the Main BG3 folder, which will create the Sound folder for you.

The .wem files are loose files, which means to 'uninstall' them, you can simply delete them or rename them from their ID (ex: 773428392.wem to Temporary.wem, which wouldn't require you to delete the files), because they take priority and override the vanilla audio .wem files so you don't have to repackage or replace the ones the game provides by default.

IMPORTANT: The Duration (ex: 2:00) of the audio files are followed by the game to the exact second, so this means that if an replacement audio clip is 30 seconds long and the vanilla audio file is 17 seconds long, the replacement clip will only play for exactly 17 seconds before getting cut off. Similarly, if an replacement audio file is 35 seconds long, and the vanilla audio file is 40, the replacement audio will the 35 seconds before ending and resulting in 5 seconds of silence. TLDR; Replacement Audio File longer than vanilla = cut prematurely, Replacement Audio FIle shorter than vanilla = audio file ending + silence.

Additionally, since the audio files correspond to specific events in the game, if an event ends prematurely or a new event takes place that has priority over the original, then it will be cut off. Example, the 17 seconds of Battle Intro cannot be skipped into After Battle Intro, however once After Battle Intro starts playing, if an enemy is killed, then Enemy Killed will start playing, and After Battle Intro will end prematurely.

It's also important to note that the music in this game fades in and out, so the first few seconds of an audio clip might be lower in volume than you would expect. To combat this, you can put silence for the first couple of seconds when you create your own replacement audio file, therefore it will "start" at full volume because the time period of the audio fading in has already elapsed. Alternatively you could increase the volume of the first two seconds to combat the volume fading in, but this would in the majority of cases ruin/distort the audio quality of the file.

Furthermore, please consider the delay of when new audio happens in the game, as well as how audio loops, because it will allow you to integrate transitions into the music. For example, After Battle Intro occurs almost instantly following Battle Intro's end, so what I did was I cut the beginning part of my song choice and designated it to Battle Intro, and put the remainding part of the song into After Battle Intro, which resulted in an almost seamless transition.

Also, since Battle Intro only happens once when you enter into battle, and After Battle Intro will continuously loop in combat until you kill an enemy (causing Enemy Killed to occur), the result is that After Battle Intro will begin without the intro of the song. The way I combated this was by pasting the beginning of my song after the remainder part of my song ended, that way it would appear as if the song simply played itself again.

Menu being too loud: Baldur's Gate 3 has a weird feature where their Main Menu Music is approximately 10 dB louder than the music that you hear in game. The "Music Volume" slider, that is found in the Baldur's Gate 3 settings, controlls both the Main Menu Music volume and the In-Game Music volume, so you aren't able to decrease the Main Menu Music volume without decreasing the In-Game Music Volume as well. To combat this, you can edit the Main Menu .wem file and decrease it by 10 dB to compensate for the differences in volume. 

There might be other noticable audio differences in Baldur's Gate 3, like the Character Creation Music being louder than In Game Music, but I am not entirely sure. The process would be the same however, where you would increase or decrease the audio files' dB to compensate. 

Main Menu Track 1 689707574 (2:52) 

Main Menu Track 2 - 190130297 (2:17)

Main Menu Track 3 - 877297356 (3:00)

More info on Main Menu .wems and Character Creation .wems found @wes47's mods. 





ID's of Battle Music .wem files:

Main Battle Music: These are the 4 audio files that you will listen to in almost every encounter. These are also the only 4 that will be included in the mod, mainly because I'm demonstrating how to replicate this process, and I have yet to experiment with all the Battle Music files, but the process should be the same. I will most likely not take requests, because it is too much time unless I personally am interested in the music , and you can use my guide to experiment on your own.

Battle Intro - (This will only occur the first time you enter combat, there doesn't seem to be a condition for it to occur again) 773428392 (0:17)

After Battle Intro - 533167408 (3:06)

Enemy Killed (downing an enemy or knocking an enemy unconscious won't trigger this, it has to be a kill. This audio clip won't repeat once you kill additional enemies, it only occurs the first time) - 26085591 (0:20)

After Enemy Killed (this will only play once until it stops and then "After Battle Intro" will continuously loop, killing another enemy doesn't trigger "Enemy Killed" and "After Enemy Killed" to play again) - 305267028 (3:10)


Miscellaneous Battle Music: These are music that you will still hear frequently often (as I'm sure most of you recognize Twisted Force), but I don't know the particulars of when they occur and am unsure of how to name them accordingly. Some of these occur in special Boss Fights, for example:
Spoiler:  
Show

Raphael has a altered Boss theme different than the regular Battle Music.

I will edit the description once I hear feedback on how to name these miscellaneous files.

Twisted Force Instrumental (Special Version) - 237906121 (2:21)

Twisted Force Instrumental - 792845498 (2:18)


Twisted Force Vocal Version with Chanting - 9646929 (1:58)

Twisted Force Instrumental Version 2- 504322320 (1:58)

Twisted Force Instrumental Version 3 - 856911435 (1:58)

Enemy Down (
This is the name provided by the Baldur's Gate 3 Playlist on Youtube, I'm not entirely sure if it has to do anything with enemies in the game) - 553297949 (1:49)

Alternate Battle Intro (recognizable) - 1017365244 (0:17)

Alternate Battle Intro 2 (
recognizable) - 1020556079 (0:17)

Alternate After Battle Intro (
recognizable) - 864757594 (3:15)

Alternate Battle Music (recognziable) - 1031476565 (2:58)

Alternate Battle Music (recognizable) - 565708481 (2:53)

Alternate Battle Music (recognizable) - 789148833 (2:04)

Alternate Battle Music (recognizable) - 544368922 (2:03)

Alternate Battle Music (recognizable) - 494002534 (2:15)

Unknown Battle Music -
315959532 (2:01)




Process on .Wem files:

(Skip ahead to "How to convert audio files back to .wem files:" if you just want to create your own Battle Music and don't want to know about other .Wem files)



How to find the .wem files by unpackaging the .pak files:

The audio of Baldur's Gate 3 is stored in .pak's, which is a file type similar to .zip and .rar which stores many files and packages them all into a singular file. So, if you search for the .wem ID's in the directory, you won't find any results, because they are packaged within the .pak files and we need to extract them to access the .wem files.

The two main .pak files responsible for audio in Baldur's Gate are "Shared.pak" and "SharedSounds.pak", which are located in Baldurs Gate 3\Data of the main Baldur's gate directory. The one that is important in this case is "SharedSounds.pak". The way to extract .pak files requires special applications, and my recommendation is "BG3 Modders Multitool" (https://github.com/ShinyHobo/BG3-Modders-Multitool), which is also useful in general for all Baldur's Gate 3 Mods. Drag and Drop "SharedSounds.pak" onto the BG3 MM icon, and it will begin to unpack the .pak files. Be patient, this will probably take 10-30 minutes. Once the extraction reaches 100% and finishes, the converted files will be stored in a folder. The default location of the folder is in the same directory as the BG3 Modders Multitool under a folder called "Unpackaged Mods".

Opening the Unpackaged Mods leads you to a new SharedSounds folder, open that and the next Public folder, and you reach two folders: "SharedDev" and "Shared". The "Shared" folder is where the majority of the actual music files are located, for example After Battle Intro and After Enemies Killed, which are both songs longer than 2 minutes. The "SharedDev" folder is where the majority of the ambience files and generally shorter files are located, and this is also where to find Battle Intro and Enemy Killed.




How to convert .wem files into listenable audio files:

To convert the .wem files into listenable audio files, you need to have another special application. My recommendation is Foobar2000 (https://www.foobar2000.org/download), with the vgmstream component/plugin (https://vgmstream.org/), which will assist in batch converting and categorizing .wem files (namely by duration, which is extremely important). It is also possible to listen to individual .wem files, as long as you know which file you're looking for at the vgmstream web-player (https://katiefrogs.github.io/vgmstream-web/). This doesn't require an external application, but is useful if you only need to doublecheck your replacement audio file or the vanilla audio file. However, Foobar2000 with the vgmstream plugin is what you'll be using in the majority of cases.

Once you finish installing Foobar2000, you need to install the vgmstream component. Here's a youtube guide (not made by me) that will assist you: https://www.youtube.com/watch?v=qyRVPU5pxhg. If you don't want to watch the video, the way to do it is by clicking the "File" tab on the top left of the Foobar2000 application, then clicking "Preferences" in the drop down menu, clicking the "Components" tab of the Preferences menu, clicking "Install" on the bottom right of the Components menu, then opening the vgmstream component that you downloaded which will be a .fb2k-component file type most likely called "foo_input_vgmstream.fb2k-component". Restart Foobar 2000, and the new component will allow Foobar 2000 to listen to and convert .wem files.

Select all (Ctrl+A) of your .Wem files located in your "UnpackagedMods" folder of the BG3-modders-multitool and drag them into Foobar2000. Alternatively, you can open the folder using the Foobar2000 "Add Folder" option in the dropdown menu of the "File" tab (top right of Foobar2000). Since there are two folders to choose from: "Shared" and "SharedDev", do one folder at a time. Be patient, this will take 10-30 minutes. Once it's finished, save the playlist with the "Save playlist" option in the dropdown menu of the "File" tab (top right of Foobar2000). This will save the playlist as a .fpl file type, which you can load later on. You can sort through your playlist by Duration, etc. from the tabs in Foobar2000. An easy way to search for files is by Ctrl + F.

Once you're finished with the extracting first folder, create a new playlist with the "New playlist" option in the dropdown menu of the "File" tab (top right of Foobar2000). Then repeat the process to extract the second folder the same as you did the first. Remember to save this new playlist as well, in case you accidentally close Foobar2000 or Foobar crashes. To load playlists, use the "Load playlist" option in the dropdown menu of the "File" tab (top right of Foobar2000).

Currently, all that Foobar2000 is doing is allowing you to listen to and categorize your .wem files. To convert them into a different file type, highlight your selection of file names, for example an individual file, and then Right Click on the selection. You can also highight multiple files by dragging left click and rectangular selecting the ones you want, or pressing Ctrl+A to highlight all or presssing Ctrl+Left Click on two or more different files to select/deselect additional files. After you've finished your selection, Right Clicking on it will produce a Drop Down Menu. Click the "Convert" tab from the drop down menu, and then "Quick Convert" from the next drop down menu. Choose which file type you want to convert to, or add your own, and then click the "Convert" button on the bottom of the "Quick Convert" Menu. Select your destination folder to store your new converted files.




How to find the ID's of the .wem files you are looking for:

The official way to find the corresponding ID's is to find how they are listed in the .lsf file which correspond to the .bnk files. However, I am not proficient in this way, so I will lead you over to https://github.com/HumansDoNotWantImmortality/bg3-sids/wiki who has an archive of ID's which are extremely helpful. Unfortunately the process isn't the same for all .bnk files, and HumansDoNotWantImmortality didn't have the Battle Music .bnk file archived, so after talking with him I eventually decided to manually find them on my own (which takes longer). The most efficient way to do it, and the ones used by the developers of Baldur's Gate 3, is with the .lsf files and .bnk files.

The way I did it was by sorting the .wem files by Duration in Foobar2000. The intuitive solution of sorting .wem files by File Size is a good idea, with the bigger file size correlating with a longer audio file, however this isn't always the case and therefore imprecise.

If you know you're looking for a longer audio file, like a song, then the "Shared" folder of .wem files is the first place to look, because the majority of the files are longer. Unfortunately you have to listen to each individual one, but by prioritizing which ones are the most likely file (by sorting by Duration), you will find them fairly quickly (approximately 3-10 minutes).

However, as with the case with some audio files, you know what you're looking for but you don't know the exact Duration. In this case, you can try to find the file on Youtube, but it might not be uploaded. The solution I came up with is by recording the vanilla audio of Baldur's Gate 3 that I wanted using a screen recording software like OBS studio. When I played it back, I noticed when the audio started and stopped, and since Baldur's Gate Audio remains exact to the second, I could figure out the approximate duration of the file. For example, to figure out how long Battle Music Intro was, I recorded the audio of me getting into combat and subtracted the start time from the end time (ex: 22-39 seconds of the recording means that Battle Music Intro was approximately 17 seconds). Since it was a shorter audio file, I looked in the "SharedDev" folder of .wem files, and I found the ID fairly quickly.

Unfortunately if you don't know how to generate the condition of the game playing the audio you're looking for, you will have to guess the duration.





How to convert audio files back to .wem files:

IMPORTANT EDIT AFTER PATCH 5.0 (NOVEMBER 30, 2023) AND BEYOND: It has come to my attention that BG3 may have changed the compression format for all .wem files from WEM OPUS to VORBIS. When you're creating your .wem files or converting your audio files back to .wem files using WWise, try VORBIS instead of WEM OPUS, and try each compression format if that doesn't work, otherwise your file will be silent.

Youtube Guide
(not made by me): https://www.youtube.com/watch?v=dvh7yA6M9QQ

Once you have your replacement audio files ready, either by downloading it from the internet or recording it yourself using an application like Audacity, etc. it is now time to convert the audio files back to .wem files. To do this, you need another special application and my recommendation is Wwise (https://www.audiokinetic.com/en/download/). You have to download it from the "Audio Kinetic Launcher", there doesn't seem to be a stand alone version, so don't be confused if you look Wwise up on google and you can't find the direct download. When you download Wwise from the Audio Kinetic Launcher, it will ask you if you want to download additional plugins for example "iZotope suite 2022.1.7.8290". I'm pretty sure you don't need to install any additional plugins, but you can if you want to be safe.

After you launch Wwise either by the Audiokinetic Launcher (Launch Wwise (64-bit) option under the Wwise tab) or by a shortcut you can find by searching "Wwise Launcher" in the Windows search bar, you will be greeted the Wwise Application. Create a new project and remember the directory of the project, because that's where your converted files will be stored. Don't be afraid from all the options, navigate to the left side of the application where you'll see a menu containing many tabs like "Game Syncs" "ShareSets" "Sessions" "Queries" "Audio" "Events" and "Soundbanks". Click the "Audio tab". In the dropdown menu there should be four folders like "Audio Devices", "Master-Mixer Hierarchy", "Actor-Mixer Hierarchy", and "Interactive Music Hierarchy". The "Interactive Music Hierarchy" is the folder we're looking for. Under the "Interactive Music Hierarchy" folder, right click the subfolder called "Default Work Unit", which will lead you to a drop down menu. Click "Import Audio Files".

In the next menu, click "Add files" and find your replacement audio files and open them. Once you're done, click "Import" on the bottom right of the menu. Look back at the "Interactive Music Hierarchy" Tab, and under the subfolder "Default Work Unit" you should see your imported Audio file. Double click on it, and a new menu will pop up in the center of the Wwise application. Click the "Conversion Tab" and you'll see a selection bar that will most likely say "Default Conversion Settings". Click on the two forward arrows button on the left of the selection bar, it will look like [>>]. Then in the drop down menu, click the Factory Conversion Settings tab, then "Vorbis", then "Vorbis Quality High".

This will close the dropdown menu and return you to the original screen. Look to the right of the selection bar, which should now say "Vorbis Quality High", and click the icon on the right that looks like an arrow pointing diagonally up to the right. In this new menu there are going to be two horizontal scrolling bars on the middle of the menu and on the bottom. Use the middle horizontal scrolling bar to scroll to the right, and you'll see a "Format" tab. This is important, otherwise your file will be silent. You need to click on the selction underneath the "Format" tab, which will most likely say "Vorbis", and change it to "WEM OPUS". On the tab to the right which says "Quality", I advise you to move the orange bar all the way to the value 256. I'm not sure how much this affects sound quality and file size, but I suggest to do the maximum quality just to be safe. Once you're done, click the "Convert" option on the middle right of the menu. The conversion should be very quick, usually 30 seconds at most.

Your new converted .wem files should be located in the same folder that your project is in, under the subfolders .cache\Windows\SFX. Copy the .wem files back to your vanilla Baldur's Gate 3 Directory at Data\Public\Shared\Assets\Sound. Rename the replacement file to the ID of the vanilla audio .wem file you are trying to replace, for example "converted.wem" to "1020556079.wem". Installation and uninstallation instructions are the same as the one described in the top of the description, so refer to them if you forget.

If your audio file is silent in the game, then you most likely didn't change the format to WEM OPUS in Wwise. Change it, and convert it again. If it's WEM OPUS and still silent, I'm not sure what the issue is, you would have to consult the comment section or look for help on the internet.





Thanks and Acknowledgements:

Borislav Slavov for being the Composer for Baldur's Gate 3, creating the score of the game and the majority of audio that you hear while playing it.

Foobar2000

VGMSTREAM

Wwise

BG3 Modders Multitool

Waxcaps for the Youtube guide on Converting Flac to Wem using Audacity and Wwise - https://www.youtube.com/watch?v=dvh7yA6M9QQ

ilaac for the Youtube guide on Converting .wem files - Foobar tutorial - https://www.youtube.com/watch?v=qyRVPU5pxhg

@XxCRAZYPOTATOxX for inspiration on main menu music

@wes47 for inspiration on main menu music, character creation music, and for making me realize that I'd save time manually looking for the .wem files, because I'm too daft to understand the .lsf and .bnk files

and most of all toHumansDoNotWantImmortality (https://github.com/HumansDoNotWantImmortality/bg3-sids/wiki/) for creating such an extensive archive, tutorial, and wiki on .bnk files. Plus, they actually want to figure out the correct way to find the ID's, which commands so much of my respect. They posted the wiki on the Larian Studio discord, and is greatly unappreciated for spending so much time and effort for the furtherment of the community. Please show them the love they deserve.