Audio modding: Difference between revisions

From Total War Modding
Line 9: Line 9:


== Events ==
== Events ==
Everything starts with an Event. The game will typically refer to Events, either in script, anim.meta file, or db tables.
Everything starts with an Event. The game will typically refer to Events either in script, anim.meta file, or db tables.


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.

Revision as of 05:09, 29 January 2024

After a long time, audio modding is now possible. This is entirely down to the years of research and work developing the tools by Ole and ChaosRobie.

The Basics

The Total War games use an audio engine called Wwise. It is a very powerful but complex system. In short Wwise produces these things called soundbanks (.bnk files) which store information about how audio is played in the game.

If you want to mod audio it would probably be a good idea to have some understanding of the basics of Wwise. Some of this is covered below, however for a more foundational understanding read the WWiser documentation, and watch the Wwise 101 and 201 YouTube tutorial series.

In Wwise there are things called objects. Some common objects we will interact with are Events, Containers, Sounds, Actor Mixers. These are explained below.

Events

Everything starts with an Event. The game will typically refer to Events either in script, anim.meta file, or db tables.

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)

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 Dialogue_Event is triggered, the game sets variables which are used to lookup the child node, which typically points to a Container which in turn points to sounds.

So for example if you are playing as the Empire, and as Karl Franz, and you move on the campaign map, the game sees that you've just moved the big man. The Dialogue_Event for this particular condition is triggered and follows the path of the provided variables, e.g. Culture: Empire, Voice Actor: Franz and plays the audio for Franz moving his army on the campaign map.

Containers

One type of Container is a Random Container. They are an organisational and control tool for sound objects. When triggered a Random Container would play one of its sounds, you guessed it, at random!

Sounds

Sound objects are how sound files are represented within WWise. Wwise uses .wav files, and exports them as .wem files.

Actor Mixers

Actor Mixers serve as an organisational and control tool for sound objects. It allows you to break sounds down into 'folders'. Mixers control who owns the sounds - if it's a UI sound, game sound, battle sound and so on. This is important to make the sound play as not all Actor Mixers have their volume set at all times.

The Tools

The main tools used in audio modding are: Audio Explorer, Audio Project Compiler, Bnk Patcher, Dat Builder, File Converters, Dialogue Event Merger, Wwiser, Wwise.

Some of these tools do the same thing just in different ways so you should read up on them individually.

Audio Explorer

The Audio Explorer is a powerful tool within the AssetEditor for exploring the audio data in the game. It can be accessed within the AssetEditor by going to Tools ==> Audio ==> Audio Explorer.

Audio Project Compiler

This tool is currently being redeveloped. This section of the wiki will be updated once that's done.

The Audio Project Compiler is a tool within the AssetEditor which you can use to build custom audio instead of using Wwise. It has templates for different types of custom sound. Fill in a few details, run the compiler then you're good to go!

Wwise

Wwise is the audio engine that WH3 uses. We can use it to build custom audio into the game. The advantage to using Wwise over the Audio Project Compiler is that it has a vast amount of functionality. The Audio Project Compiler is essentially a very very simple version of what Wwise.

It is free for projects containing up to 200 unique sounds. If you need than 200 sounds you can contact Wwise and to request a non-commercial licence which allows unlimited sounds. Audiokinetic have already provided non-commercial licences for several WH3 audio modding projects so should do so again.

Wwise can be downloaded here. For WH3 audio modding you need version 2019.2.15.7667.

The Audio Mixer Wwise project can be downloaded here.

Bnk Patcher

This tool is intended for use by anyone who wishes to use Wwise rather than the AssetEditor Audio Project Compiler to mod audio. There are some advantanges (and disadvantages) to using Wwise over the AssetEditor. The main advantage is that you can use the full set of features that Wwise offers which is vast. The AssetEditor audio tools are a very simple and much more user friendly tool.

CA use a custom version of Wwise for WH3 audio. Different versions of Wwise produce objects in different formats. The closest public release of Wwise to CA's version is 2019.2.15.7667. CA's version of Wwise produces a different header in their soundbanks, and produces some music objects in a different format to Wwise version 2019.2.15.7667. Therefore a patcher is required.

The tool can be downloaded here.

Dat Builder

The Dat Builder tool is intended for use by anyone who wishes to use Wwise rather than the AssetEditor's Audio Project Compiler to mod audio. It is a script to write the dat file necessary for custom non-VO audio.

The tool can be downloaded here.

File Converters

Some tools to convert to and from the common file types used in audio modding. More info on using each can be found in Converting Between File Types.

The tools can be downloaded here.

Dialogue_Event Merger

This is an excellent tool created by ChaosRobie which enables VO. The Audio Mixer mod uses this to merge the new custom VO created within Wwise into the vanilla soundbanks.

The tool can be downloaded here.

Wwiser

Wwiser is a Wwise .bnk parser, to assist in handling audio from games using the Wwise engine. It can be used to view soundbanks and find information about each object in the bnk.

Wwiser can be downloaded here.

Using the Audio Explorer

The Audio Explorer is a powerful tool that has many use cases. Some of these are detailed below.

Learning Wwise

The tool allows pretty much all Wwise objects to be explored. This is very useful to learn how you later can use the Audio Project Complier 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.

Finding Sounds

How to make sense of the sound names in total war

Using this tool, it's 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.

For a detailed guide on replacing vanilla audio refer to this section.

Playing Sounds

How to make sense of the sound names in total war

Once you've found a sound you can then play it!

Click on the sound, then click the Play Sound button.

If it doesn't play make sure you have the Skip loading wem (sound) files setting unticked in your Asset Editor settings.

Researching Dialogue_Events

You can browse for specific Dialogue_Events to see what type of sounds they play in vanilla.

Let's say you want to make your own voice acting for a character of yours. You have looked through the list of all the Dialogue_Events, and you want to look more into what exactly the voice acting for the battle_vo_order_attack Dialogue_Event sounds like in vanilla.

How to find the correct ActorMixer for adding custom sounds

So search the Audio Explorer for a Dialogue_Event e.g. battle_vo_order_attack.

Then browse to a voice actor of your choosing, for example Karl Franz. There you can see what his voice acting for this Dialogue_Event sounds like and make your own for your character in a similar vein.

Understanding Actor Mixers and Audio Busses

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.

VO Audio Modding

Dialogue_Events are what the game uses for VO. They are triggered by certain conditions being met in game. So for example, campaign_vo_selected is triggered when you select one of your own characters on the campaign map. Or battle_vo_order_attack is triggered when you tell one of your units to attack another in battle. Or campaign_vo_cs_proximity is for VO that plays when certain characters are within proximity of each other on the campaign map.

Characters with multiple state conditions in the same Dialogue_Event

Dialogue_Events can also have several conditions within themselves. So for example, campaign_vo_move can receive two different conditions, moving while at Sea, and moving in general. Several characters make use of this, for example Markus Wulfhart: wh2_dlc13_vo_actor_Empire_Markus_Wulfhart.Any and wh2_dlc13_vo_actor_Empire_Markus_Wulfhart.sea. If a character is moving at sea and has a 'sea' path then that will take priority over an 'Any' path. Likewise if a character does not have a 'sea' path then their 'Any' path with play while at sea.

Below is a full list of all the different Dialogue_Events in the game. You can add custom audio for each of these. To find out exactly what each Dialogue_Event is used for refer to the Researching Dialogue_Events.

Battle VO

This stuff happens in a battle. You don't need to use every single battle_vo Dialogue_Event if you don't want to. If your voice actor does not have any sound for the particular game condition associated with a Dialogue_Event then it will play the sounds from the battle_vo_order_generic_response Dialogue_Event.

   battle_vo_order_attack 
   battle_vo_order_generic_response
   battle_vo_order_halt
   battle_vo_order_move
   battle_vo_order_select
   battle_vo_order_withdraw 
   battle_vo_order_withdraw_tactical
   battle_vo_order_flying_charge
   battle_vo_order_formation_lock 
   battle_vo_order_formation_unlock  
   battle_vo_order_group_created 
   battle_vo_order_group_disbanded 
   battle_vo_order_guard_off 
   battle_vo_order_guard_on 
   battle_vo_order_melee_off 
   battle_vo_order_melee_on
   battle_vo_order_fire_at_will_off 
   battle_vo_order_fire_at_will_on 
   battle_vo_order_skirmish_off 
   battle_vo_order_skirmish_on 
   battle_vo_order_special_ability 
   battle_vo_order_change_formation 
   battle_vo_order_change_ammo
   battle_vo_order_climb 
   battle_vo_order_man_siege_tower 
   battle_vo_order_move_ram 
   battle_vo_order_move_siege_tower 
   battle_vo_order_pick_up_engine 
   battle_vo_order_short_order 
   battle_vo_order_move_alternative 
   battle_vo_order_attack_alternative 
   battle_vo_order_bat_mode_capture_neg 
   battle_vo_order_bat_mode_capture_pos 
   battle_vo_order_bat_mode_survival 
   battle_vo_order_bat_speeches 
   battle_vo_order_battle_continue_battle 
   battle_vo_order_battle_quit_battle

Conversational Battle VO

This is the chitter chatter that goes on between units.

   battle_vo_conversation_allied_unit_routing 
   battle_vo_conversation_clash 
   battle_vo_conversation_def_own_army_murderous_prowess_100_percent 
   battle_vo_conversation_def_own_army_murderous_prowess_75_percent 
   battle_vo_conversation_dissapointment 
   battle_vo_conversation_encouragement 
   battle_vo_conversation_enemy_army_at_chokepoint 
   battle_vo_conversation_enemy_army_black_arks_triggered 
   battle_vo_conversation_enemy_army_has_many_cannons 
   battle_vo_conversation_enemy_skaven_unit_revealed 
   battle_vo_conversation_enemy_unit_at_rear 
   battle_vo_conversation_enemy_unit_charging 
   battle_vo_conversation_enemy_unit_chariot_charge 
   battle_vo_conversation_enemy_unit_dragon 
   battle_vo_conversation_enemy_unit_flanking 
   battle_vo_conversation_enemy_unit_flying 
   battle_vo_conversation_enemy_unit_large_creature 
   battle_vo_conversation_enemy_unit_revealed 
   battle_vo_conversation_enemy_unit_spell_cast 
   battle_vo_conversation_environment_ground_type_forest 
   battle_vo_conversation_environment_ground_type_mud 
   battle_vo_conversation_environment_in_cave 
   battle_vo_conversation_environment_in_water 
   battle_vo_conversation_environment_weather_cold 
   battle_vo_conversation_environment_weather_desert 
   battle_vo_conversation_environment_weather_rain 
   battle_vo_conversation_environment_weather_snow  
   battle_vo_conversation_own_army_at_chokepoint 
   battle_vo_conversation_own_army_black_arks_triggered 
   battle_vo_conversation_own_army_caused_damage 
   battle_vo_conversation_own_army_missile_amount_inferior 
   battle_vo_conversation_own_army_missile_amount_superior 
   battle_vo_conversation_own_army_peasants_fleeing 
   battle_vo_conversation_own_army_spell_cast 
   battle_vo_conversation_own_unit_artillery_fire 
   battle_vo_conversation_own_unit_artillery_firing 
   battle_vo_conversation_own_unit_artillery_reload 
   battle_vo_conversation_own_unit_fearful 
   battle_vo_conversation_own_unit_moving 
   battle_vo_conversation_own_unit_routing 
   battle_vo_conversation_own_unit_under_dragon_firebreath_attack 
   battle_vo_conversation_own_unit_under_ranged_attack 
   battle_vo_conversation_own_unit_wavering 
   battle_vo_conversation_proximity 
   battle_vo_conversation_siege_attack 
   battle_vo_conversation_siege_defence 
   battle_vo_conversation_storm_of_magic
   battle_vo_conversation_def_own_army_murderous_prowess_100_percent 
   battle_vo_conversation_def_own_army_murderous_prowess_75_percent 
   battle_vo_conversation_hef_own_army_air_units 
   battle_vo_conversation_hef_own_army_low_stength 
   battle_vo_conversation_lzd_own_army_dino_rampage
   battle_vo_conversation_skv_own_unit_spawn_units 
   battle_vo_conversation_skv_own_unit_tactical_withdraw
   battle_vo_conversation_skv_own_unit_warpfire_artillery 

Frontend

The frontend VO which plays when you select a faction to play as.

  frontend_vo_character_select 

Campaign VO

These are events which play on the campaign map.

   campaign_vo_agent_action_failed
   campaign_vo_agent_action_success
   campaign_vo_attack
   campaign_vo_created
   campaign_vo_diplomacy_negative
   campaign_vo_diplomacy_positive
   campaign_vo_diplomacy_selected
   campaign_vo_move
   campaign_vo_move_garrisoning
   campaign_vo_move_next_turn
   campaign_vo_new_commander
   campaign_vo_no
   campaign_vo_no_short
   campaign_vo_post_battle_defeat
   campaign_vo_post_battle_victory
   campaign_vo_retreat
   campaign_vo_selected
   campaign_vo_selected_allied
   campaign_vo_selected_fail
   campaign_vo_selected_first_time
   campaign_vo_selected_neutral
   campaign_vo_selected_short
   campaign_vo_ship_dock
   campaign_vo_stance_ambush
   campaign_vo_stance_channeling
   campaign_vo_stance_default
   campaign_vo_stance_double_time
   campaign_vo_stance_land_raid
   campaign_vo_stance_march
   campaign_vo_stance_patrol
   campaign_vo_stance_set_camp
   campaign_vo_stance_settle
   campaign_vo_yes
   campaign_vo_yes_short
   campaign_vo_yes_short_aggressive
   campaign_vo_cam_disband 
   campaign_vo_cam_disbanded_neg 
   campaign_vo_cam_disbanded_pos 
   campaign_vo_cam_skill_weapon_tree 
   campaign_vo_cam_skill_weapon_tree_response 
   campaign_vo_cam_tech_tree 
   campaign_vo_cam_tech_tree_response 
   campaign_vo_level_up 
   campaign_vo_mounted_creature 
   campaign_vo_recruit_units 
   campaign_vo_retreat 
   campaign_vo_special_ability 
   campaign_vo_stance_astromancy 
   campaign_vo_stance_muster 
   campaign_vo_stance_raise_dead 
   campaign_vo_stance_set_camp_raiding 
   campaign_vo_stance_stalking 
   campaign_vo_stance_tunneling
   gotrek_felix_arrival 
   gotrek_felix_departure 

Campaign Conversational VO

The chitter chatter that occurs on the campaign map.

   campaign_vo_cs_city_buildings_damaged 
   campaign_vo_cs_city_high_corruption 
   campaign_vo_cs_city_other_generic 
   campaign_vo_cs_city_own_generic 
   campaign_vo_cs_city_public_order_low 
   campaign_vo_cs_city_riot 
   campaign_vo_cs_city_under_siege 
   campaign_vo_cs_confident 
   campaign_vo_cs_enemy_region_generic 
   campaign_vo_cs_forbidden_workshop_purchase_doomrocket 
   campaign_vo_cs_forbidden_workshop_upgrade_doomflayer 
   campaign_vo_cs_forbidden_workshop_upgrade_doomwheel 
   campaign_vo_cs_forbidden_workshop_upgrade_weapon_teams 
   campaign_vo_cs_hellforge_accept 
   campaign_vo_cs_hellforge_customisation_category 
   campaign_vo_cs_hellforge_customisation_unit 
   campaign_vo_cs_in_forest 
   campaign_vo_cs_in_mountains 
   campaign_vo_cs_in_rain 
   campaign_vo_cs_in_snow 
   campaign_vo_cs_intimidated 
   campaign_vo_cs_monster_pens_dilemma_ghrond 
   campaign_vo_cs_monster_pens_dilemma_lustria 
   campaign_vo_cs_monster_pens_dilemma_naggaroth 
   campaign_vo_cs_monster_pens_dilemma_old_world 
   campaign_vo_cs_monster_pens_event 
   campaign_vo_cs_near_sea 
   campaign_vo_cs_neutral 
   campaign_vo_cs_on_sea 
   campaign_vo_cs_other_character_details_panel_low_loyalty 
   campaign_vo_cs_other_character_details_panel_neutral 
   campaign_vo_cs_other_character_details_panel_positive 
   campaign_vo_cs_post_battle_captives_enslave 
   campaign_vo_cs_post_battle_captives_execute 
   campaign_vo_cs_post_battle_captives_release 
   campaign_vo_cs_post_battle_close_defeat 
   campaign_vo_cs_post_battle_close_victory 
   campaign_vo_cs_post_battle_defeat 
   campaign_vo_cs_post_battle_great_defeat 
   campaign_vo_cs_post_battle_great_victory 
   campaign_vo_cs_post_battle_settlement_do_nothing 
   campaign_vo_cs_post_battle_settlement_establish_foreign_slot 
   campaign_vo_cs_post_battle_settlement_loot 
   campaign_vo_cs_post_battle_settlement_occupy 
   campaign_vo_cs_post_battle_settlement_occupy_factory 
   campaign_vo_cs_post_battle_settlement_occupy_outpost 
   campaign_vo_cs_post_battle_settlement_occupy_tower 
   campaign_vo_cs_post_battle_settlement_raze 
   campaign_vo_cs_post_battle_settlement_reinstate_elector_count 
   campaign_vo_cs_post_battle_settlement_sack 
   campaign_vo_cs_post_battle_settlement_vassal_enlist 
   campaign_vo_cs_post_battle_victory 
   campaign_vo_cs_pre_battle_fight_battle 
   campaign_vo_cs_pre_battle_retreat 
   campaign_vo_cs_pre_battle_siege_break 
   campaign_vo_cs_pre_battle_siege_continue 
   campaign_vo_cs_proximity 
   campaign_vo_cs_sacrifice_to_sotek 
   campaign_vo_cs_sea_storm 
   campaign_vo_cs_spam_click 
   campaign_vo_cs_summon_elector_counts_panel_open_vo 
   campaign_vo_cs_tzarkan_calls_and_taunts 
   campaign_vo_cs_tzarkan_whispers 
   campaign_vo_cs_weather_cold 
   campaign_vo_cs_weather_hot 
   campaign_vo_cs_wef_daiths_forge

Replacing Vanilla Audio

An example of what can be done by replacing vanilla audio is the excellent Smart Throgg mod by Oh_Man.

Browsing the Audio Explorer to find a wem (step 2).

1. First make sure you have the Skip loading wem (sound) files setting unticked in your Asset Editor settings.

Finding the ID of a voice actor (step 3).

2. There are 2 types of sound events in WH3, normal 'events' and 'dialogue_events'. We'll start with replacing the audio for normal events. These are basically any event whose string includes the word Throgg.

Finding the voice actor ID in a bnk dump (step 5).

Go to Tools > Audio > Audio Explorer. Searching for the event Play_Nor_Throgg_Dip_Emp_Greet_Pos_01 we can see that the corresponding sound for that event is 718902042.wem.

In RPFM replace that .wem file in your pack with your own. Repeat this process for all events whose names include Throgg.

3. Next we will deal with dialogue_events. The .wem files for these are slightly harder to find as AE doesn't (currently) have deeper browsing to search for nodes of Dialogue_Events. Searching the Dialogue_Event frontend_vo_character_select and selecting wh_dlc08_vo_actor_Norsca_Throgg we can see the .wem files that play here e.g. 37798848.wem. We can also see the ID that Wwise hashes wh_dlc08_vo_actor_Norsca_Throgg into which is 2590048255.

Finding the Dialogue_Event ID in a bnk dump (step 6).

4. This works for dialogue_events that we know the name of such as this but what about all the others we can't remember? That would involve manually searching with the Audio Explorer until you found every instance of wh_dlc08_vo_actor_Norsca_Throgg which isn't a good idea. So instead we use RPFM to export all the soundbanks that would contain the relevant dialogue_events.

Those .bnk files are: frontend_vo__core.bnk campaign_vo_conversational__core.bnk campaign_vo_conversational__warhammer3.bnk campaign_vo__core.bnk battle_vo_orders__core.bnk battle_vo_generals_speech__core.bnk battle_vo_generals_speech__warhammer3.bnk battle_vo_conversational__core.bnk battle_vo_conversational__warhammer3.bnk

Using campaign_vo__core.bnk as an example, load the .bnk in Wwiser, then click Dump banks. This will output an XML file of the contents of the .bnk which we can then search through.

5. We know from the Audio Explorer that wh_dlc08_vo_actor_Norsca_Throgg is hashed by Wwise into the ID 2590048255. So using whichever programme you want to browse the XML file ctrl+f for that ID and it will show every node which contains that ID.

6. Scroll up until you get to the dialogue_event parent of that node and copy the ID (va) for that dialogue_event e.g. 87890740.

7. Now back in the Audio Explorer go to File > Load HIRC from ID and search for 87890740.

8. This will show you that dialogue_event on the right hand side. Scroll down all the way to the bottom and you will see the original string that 87890740 was hashed from — campaign_vo_stance_default. If it's a long text to scroll through copy the text into a text document, click on the bottom of the scroll bar, and you get to the bottom much quicker!

9. Search the Audio Explorer for this Dialogue_Event and look for wh_dlc08_vo_actor_Norsca_Throgg. Replace the .wem files shown there. Repeat this process for every instance of 2590048255 in each of those .bnk files. campaign_vo__core.bnk is by far the biggest, the others will have less to do so don't be put off! That's it.

Converting Between File Types

Requirements:

  1. Wwise (version 2019.2.15.7667)
  2. FFMPEG
  3. vgmstream

ivf to mp4, mp4 to ivf, mp3 to wav (FFMPEG)

1. Place the bat file in "C:\installation_location\ffmpeg\bin"

2. Place the files to convert in "C:\installation_location\ffmpeg\bin"

3. Run the bat file.

wem to wav (vgmstream)

1. Place the bat file in "C:\installation_location\vgmstream"

2. Place the files to convert in "C:\installation_location\vgmstream"

3. Run the bat file.

wav to wem

1. Put your wav files in "C:\wav_to_wem\convert\input".

2. Run convert.bat 3. Get your wem files from "C:wav_to_wem\convert\output".

4. If it still doesn't work for you, in convert.txt change "C:\Program Files (x86)\Audiokinetic\Wwise 2019.2.15.7667\Authoring\x64\Release\bin\WwiseCLI.exe" to whatever the location is of WwiseCLI.exe on your computer then resave it as convert.bat. Oh and make sure Wwise (version 2019.2.15.7667) is installed.

ca_vp8 to ivf

1. Click on a .ca_vp8 file in RPFM and click Convert to IVF

ivf to ca_vp8

1. Change your file's extension from .ivf to .ca_vp8. 2. Import your file to RPFM. 3. Click on your file and click Convert to CAMV.