Audio modding: Difference between revisions

From Total War Modding
No edit summary
No edit summary
Line 3: Line 3:
== Wwise ==
== Wwise ==
The total war games uses an audio engine called Wwise. This is a very powerful, but complex system. If you want to audio modding, you also need to get a basic understanding of the tool.
The total war games uses an audio engine called Wwise. This is a very powerful, but complex system. If you want to audio modding, you also need to get a basic understanding of the tool.
Its higly recommended that you read '''[https://github.com/bnnm/wwiser/blob/master/doc/WWISER.md this]''' and spend some time exploring the data using the "Audio Explorer" tool


=== WWise Naming ===
=== WWise Naming ===
The first thing to understand, there is no names in wwise. When a wwise project is compiled (saved for use) the tool converts all the names into id strings. This is why the game has a ton of files called 9484940112.wem. At some point they were named Karl_Eating_Goblins.wem and so on, but that name is converted (hashed)
The first thing to understand, there is no names in wwise. When a wwise project is compiled (saved for use) the tool converts all the names into ids. This is why the game has a ton of files called 9484940112.wem. At some point they were named Karl_Eating_Goblins.wem and so on, but that name is converted (hashed)


=== Wwise event structure ===
=== Wwise event structure ===
Everything in wwise starts with an event (apart from music).
Everything in wwise starts with an event (apart from music which is party controlled by some strange script). '''The game will typically refer to the events, either in script, anim.meta file or db.'''


There are two event types, Event and Dialog_event. After the event there is a chain of object that leads you to the actual audio played.  
There are two event types, '''Event''' and '''Dialog_event'''. After the event there is a chain of object that leads you to the actual audio played.  


For example this basic event with will play a random sound from a collection of two.
For example this basic '''Event''' will play a random sound from a collection of two.


Karl_Eating_Goblin_Event => Karl_Eating_Goblin_Event_ActionPlay => Random Container => Soundx.mp3, soundy.mp3.  
Karl_Eating_Goblin_Event => Karl_Eating_Goblin_Event_ActionPlay => Random Container => Soundx.mp3 and soundy.mp3.  


They follow a basic pattern most of the time. Event => Action => Container (optional) => Sound(s)
They follow a basic pattern most of the time. Event => Action => Container (optional) => Sound(s)


For more information look at wwisers documentation (without the project, there would be no audio modding) => https://github.com/bnnm/wwiser/blob/master/doc/WWISER.md


The second event type is a dialog_Event. It has nothing to do with dialog, its a lookup table that results in container or sound object.  
 
The second event type is a '''Dialog_Event'''. It has nothing to do with dialog, its a lookup table that results in container or sound object.  
{| class="wikitable"
{| class="wikitable"
|+Enemy_spotted dialog event
|+Enemy_spotted dialog event
Line 46: Line 50:
Currently Dialog_Events can not be modded, but soon...
Currently Dialog_Events can not be modded, but soon...


 
The last important bit is the '''ActorMixer''' object. This object controls who owns the sounds. Is it a UI sound, game sound, battle sound and so on. This is important to make the sound play as not all ActorMixer has their volume set at all times
The last important bit is the ActorMixer object. This object controls who owns the sounds. Is it a UI sound, game sound, battle sound and so on. This is important to make the sound play as not all ActorMixer has their volume set at all times


== Exploring Wwise in AssetEditor. ==
== Exploring Wwise in AssetEditor. ==
In AssetEditor there is a tool for exploring the audio data, called "Audio Explorer". This can be used to learn about how wwise works. It also allows you to find which ActorMixer Id you should use and what file to replace if you want to update the sound of something.  
In AssetEditor there is a tool for exploring the audio data, called "Audio Explorer". This can be used to learn about how wwise works. It has multiple use case.  
[[File:AssetEditor audio tool.png|left|thumb]]In the tool you get a list of all the events in the game. Under extra you can select if you want Events, Dialog_events or both. Picking one from the dropdown gives you the wwise object graph for the selected events.
[[File:AssetEditor audio tool.png|thumb|alt=|none]]  


In the example here, you see the "Evemt_battle_IND_Small_arms_dlc12_rattling_gun_fire_play_event". Somewhere in the game database or meta data files, there will be a reference to this name.  
=== Learn how wwise works ===
The tool allows pretty much all wwise objects to be explored. This is very useful to learn how you later can use the compiler to add new sounds. Under extra you can pick between Events and Dialog_Events.


The event contains a play action, followed by a set of random containers. Why they are nested instead of one large, no one knows. But from this you can see all the sounds connected. If you want to replace a specific sound, this gives you the wav file to replace. The tool also allows you to preview the sounds.  
The left side shows the full graph of the selected event, while the right side shows a detailed view of the Wwise data of the selected node.  


=== Find what sound file to replace for a given event ===
[[File:Audio explorer find soundname.png|thumb]]
Using this tool its very easy to lean which sound file is linked to what event.


Say you want to make a mod that replaces all of Throggs diplomacy lines. Doing a search in the database will give you all the events used, you can then look that up in the events view.


If one takes the event "Play_Nor_Throgg_Dip_Dwf_Greet_Neg_02" which is for when Throgg talks to dwarfs, one can see that this is linked to the sound file "605570708.wem"




 
=== Learn which audiomixer and audio bus is used for a group of sounds ===
=== Adding new Audio (Soon to be released, fixing bugs) ===
[[File:Audio explorer find mixer.png|thumb]]
All sounds have to be connected to a mixer (which in turn is connected to a bus). Not all busses have their volume set at all times. For example the UI and Battle bus is not both enabled at the same time. Because of this its important that the correct mixer is selected when adding new sounds. When selecting a Sound node on the left side, "Parent structure" is added on the right side. Here you can see the mixers and busses connected to the sound. you typically want to use the fist id of the first ActorMixer with an audio bus for the "RootAudioMixer" setting in your custom audio project.
=== Adding new Audio ===
We have tried to make adding new sounds as simple as possible. This is done using the Audio Compiler in AssetEditor. AssetEditor tries to fill out as much data as possible, to make it as simple as possible.
We have tried to make adding new sounds as simple as possible. This is done using the Audio Compiler in AssetEditor. AssetEditor tries to fill out as much data as possible, to make it as simple as possible.


This is done using the Audio Compiler, which takes a textfile as an input. The format looks like this:
The format looks like this:
  {
  {
   "Settings": {
   "Settings": {
    "Version": 1,
     "BnkName": "campaign_diplomacy",
    "OutputGame": "Warhammer3",
     "BnkName": "campaign_diplomacy__ovn",
     "RootAudioMixer": "54848735",
     "RootAudioMixer": "54848735",
     "Language": "English(uk)"
     "Language": "English(uk)"
Line 90: Line 101:
!Description
!Description
!Example Value
!Example Value
|-
|Settings.Version
|The version of the project file
|1
|-
|Settings.OutputGame
|The game to compile the audio project to.
|Warhammer3
|-
|-
|Settings.BnkName
|Settings.BnkName
|The name of the created bnk file. Files can not be renamed as the file reference the name internally.  
|The name of the created bnk file. Files can not be renamed as the file reference the name internally.
|
|customfaction_campaign_diplomacy
|-
|-
|Settings.RootAudioMixer
|Settings.RootAudioMixer
|The mixer the sounds should belong to
|The mixer the sounds should belong to. See "Learn which audiomixer and audio bus is used for a group of sounds"
|54848735, which is the id for diplomacy lines
|54848735, which is the id for diplomacy lines
|-
|-
Line 120: Line 123:
|-
|-
|Event.Sound
|Event.Sound
|The path to the audio file. At this point it needs to be imported manually and converted
|The path to the audio file in a packf
|Audio\\WWise\\906470917.wem
|Audio\\WWise\\906470917.wem
|-
|Event.FileSystemSound
|The path to the audio file on disk. It will be auto converted to a wem
|C:\\Users\\username\\soundLib\\wet-fart-6139.mp3
|}
|}


Coming features:
Coming features:


* Audio file importer/converter
* Support for adding dialog_events
* Support for adding dialog_events
* Support for containers like random.
* Support for containers like random.

Revision as of 14:57, 19 May 2023

After a long time, Audio modding is now possible (for Warhammer 3 at least!)

Wwise

The total war games uses an audio engine called Wwise. This is a very powerful, but complex system. If you want to audio modding, you also need to get a basic understanding of the tool.

Its higly recommended that you read this and spend some time exploring the data using the "Audio Explorer" tool

WWise Naming

The first thing to understand, there is no names in wwise. When a wwise project is compiled (saved for use) the tool converts all the names into ids. This is why the game has a ton of files called 9484940112.wem. At some point they were named Karl_Eating_Goblins.wem and so on, but that name is converted (hashed)

Wwise event structure

Everything in wwise starts with an event (apart from music which is party controlled by some strange script). The game will typically refer to the events, either in script, anim.meta file or db.

There are two event types, Event and Dialog_event. After the event there is a chain of object that leads you to the actual audio played.

For example this basic Event will play a random sound from a collection of two.

Karl_Eating_Goblin_Event => Karl_Eating_Goblin_Event_ActionPlay => Random Container => Soundx.mp3 and soundy.mp3.

They follow a basic pattern most of the time. Event => Action => Container (optional) => Sound(s)

For more information look at wwisers documentation (without the project, there would be no audio modding) => https://github.com/bnnm/wwiser/blob/master/doc/WWISER.md


The second event type is a Dialog_Event. It has nothing to do with dialog, its a lookup table that results in container or sound object.

Enemy_spotted dialog event
UnitVoiceActor UnitType SpottedFacton Child
Orc_Female_1 Ranged Human 123
Orc_Male_1 Ranged DarkElf 456
OrC_Male2 Melee Orc 678

When the even is triggered, the game sets a set of variables which are used to lookup the child node, which typically points to a Container which in turn points to sounds

Currently Dialog_Events can not be modded, but soon...

The last important bit is the ActorMixer object. This object controls who owns the sounds. Is it a UI sound, game sound, battle sound and so on. This is important to make the sound play as not all ActorMixer has their volume set at all times

Exploring Wwise in AssetEditor.

In AssetEditor there is a tool for exploring the audio data, called "Audio Explorer". This can be used to learn about how wwise works. It has multiple use case.

Learn how wwise works

The tool allows pretty much all wwise objects to be explored. This is very useful to learn how you later can use the compiler to add new sounds. Under extra you can pick between Events and Dialog_Events.

The left side shows the full graph of the selected event, while the right side shows a detailed view of the Wwise data of the selected node.

Find what sound file to replace for a given event

Audio explorer find soundname.png

Using this tool its very easy to lean which sound file is linked to what event.

Say you want to make a mod that replaces all of Throggs diplomacy lines. Doing a search in the database will give you all the events used, you can then look that up in the events view.

If one takes the event "Play_Nor_Throgg_Dip_Dwf_Greet_Neg_02" which is for when Throgg talks to dwarfs, one can see that this is linked to the sound file "605570708.wem"


Learn which audiomixer and audio bus is used for a group of sounds

Audio explorer find mixer.png

All sounds have to be connected to a mixer (which in turn is connected to a bus). Not all busses have their volume set at all times. For example the UI and Battle bus is not both enabled at the same time. Because of this its important that the correct mixer is selected when adding new sounds. When selecting a Sound node on the left side, "Parent structure" is added on the right side. Here you can see the mixers and busses connected to the sound. you typically want to use the fist id of the first ActorMixer with an audio bus for the "RootAudioMixer" setting in your custom audio project.

Adding new Audio

We have tried to make adding new sounds as simple as possible. This is done using the Audio Compiler in AssetEditor. AssetEditor tries to fill out as much data as possible, to make it as simple as possible.

The format looks like this:

{
  "Settings": {
    "BnkName": "campaign_diplomacy",
    "RootAudioMixer": "54848735",
    "Language": "English(uk)"
  },

  "Events": [
    {
      "Name": "Play_Foo",
      "Sound": "Audio\\WWise\\729867288.wem"
    },
    {
      "Name": "Play_Bar",
      "Sound": "Audio\\WWise\\906470917.wem"
    }]
}
Project explanation
Attribute Description Example Value
Settings.BnkName The name of the created bnk file. Files can not be renamed as the file reference the name internally. customfaction_campaign_diplomacy
Settings.RootAudioMixer The mixer the sounds should belong to. See "Learn which audiomixer and audio bus is used for a group of sounds" 54848735, which is the id for diplomacy lines
Settings.Language If the file is a language bnk, this needs to be set to the same name as one of the audio folders in the game English(uk)
Events A list of all the events
Event.Name The name which the game will use to find the sound Play_Foo
Event.Sound The path to the audio file in a packf Audio\\WWise\\906470917.wem
Event.FileSystemSound The path to the audio file on disk. It will be auto converted to a wem C:\\Users\\username\\soundLib\\wet-fart-6139.mp3

Coming features:

  • Support for adding dialog_events
  • Support for containers like random.
  • Fixed names for known ActorMixers

File Types

Wem => The audio file format used by wwise

Bnk => The sound database used by wwise

Dat => A lookup table for connecting event names to wwise

Json => Projectfile for the audio compiler.