CCG V3-1 Conversion:Part 3 VoiceSets

From NWN1 Custom Content Guide

Jump to: navigation, search

Contents

Custom Voicesets

Notes
  • I have started with the introductory text from Custom Soundsets by Ddraigcymraeg and clarified, updated, and added relevant screenshots and detail that I felt were lacking.
  • Voicesets are specific to voices. NWN includes other sound types (ambient and environment sounds) as well. You don’t need to package these other sounds into a voiceset to use them.
  • If you simply want to trigger a unique sound for one of your characters from a script, you do not need a soundset (see the section on placeable sounds). Just add the .wav file to your module and trigger it from a script.
  • The original tutorial expressed some confusion over whether or not to use hakpak’s for sounds – I have tried to clean up this confusion as best I can (in short, use them).
  • Any omissions or errors are mine and not Ddraigcymraeg’s.

This tutorial covers creating a custom voiceset for NWN. A voiceset is a package of standard voices that can be emitted by PCs, NPCs, henchmen, and monsters. All of the different voiceset types are similar but the number of expressions is different for each. You will see these referred to in some places as soundsets. The meaning is generally the same – in fact, Bioware seems to use the terms interchangeably. I will use voiceset because it more clearly represents what these are.

Before you delve too deeply into this, you may want to think first about where you will get your voices. I can suggest two sources:

  • I have seen some people load the soundtrack for a movie/show onto their PC. Then use an audio mixing program to select and edit out brief snippets from one of the main characters.
  • Alternately, and more creatively, record your own. Does your voice sound too thin and reedy in a straight recording? If you have a good soundcard with editing tools, you would be surprised at the types of filters that are available for voices these days (male to female, low to high, echo, etc.) that can take you and turn you into somebody else. If you are going this route, pre-script all of the phrases you want (they don’t have to be the same words as the ones in the official module as long as they convey the same meaning).

Part 1: Understanding How NWN Represents Voices

Let’s look at how NWN uses current voicesets in the Aurora Toolset. Try this exercise:

  1. Open up the Aurora Toolset.
  2. Create a new Module (we will call it Voice Tutorial for lack of a better name). Use the Area Wizard to create at least one Area. Use the defaults to set up the area and choose something simple like a Castle Interior.
  3. Select Wizards | Creature Wizard.
  4. For Monster Type select a half-Elf (we will talk about the standard weapon types later in this section).
  5. Click Next.
  6. Enter a class or two.
  7. Click Next.
  8. Verify that this is a male, half-elf. Select a portrait.
  9. Click Next.
  10. Choose a faction.
  11. Click Next.
  12. Choose a name.
  13. Click Next.
  14. Assign to the NPCs, Half-Elves category.
  15. Click Next. Click Next.
  16. Check the Launch Item Properties checkbox.
  17. Click Finish.
  18. Select the Advanced tab.
  19. Now you can select a Sound Set (lower right side). Press …
  20. Use the filter to choose an NPC, male voiceset.

What does this do, exactly? By assigning a voiceset to this NPC, the game engine will automatically emit appropriate sounds from this set based on triggers within the game (for example, the NPC will make one of several noises when attacking). I don’t need to program this individually for each NPC – the game engine already knows which sounds to play when.

You can use also use wav files to play sounds during a character’s dialog. This is an example of using a wav file that does not have to be part of a voiceset. To do this, create a new conversation. Add a line of text. Select the line of text. Find the Other Actions tab at the bottom right hand corner of the conversation editor.

Type in the name of the wav file you created or page down on the list and select it. Now, when that dialog is triggered, the sound file will accompany the text in the game.

Image:Ccg fig 22.jpeg

Sound Files (wav)

Notes
  • I did a quick test of sound formats using Windows’ Sound Recorder.
    • 8KHz, 8bit mono PCM wav files work (but the sound quality is poor)
    • 48KHz, 16 bit mono PCM wav files work.
    • I would recommend something like a 44KHz, 16 bit mono wav file.
  • Stereo wav files do not work. This intuitively makes sense because a voice comes from a single source at a single location (although you can use stereo sources for ambient sounds).
  • The .wav files that come with NWN are actually mp3 files. It is not clear how to edit or work with them though – you cannot use mp3 or BMU files directly as sound files (check the Ambient Sound tutorial from Bioware if you don’t know what a BMU is).
  • Don’t get too caught up in that though – it is probably easier for you to work with .wav files anyway. The only real advantage of mp3 is that they are compressed; therefore smaller.

What you should see from all of this is that there are different levels of granularity in the way NWN represents voices. The basic sound file has a .wav extension. Where can I find the official sound files from Bioware? Through NWN Explorer, of course.

  1. Open NWN Explorer.
  2. Select File | Open Neverwinter Nights.
  3. Select data/voicesets.bif (you can also find some in data/sounds.bif and in data/convo.bif).
  4. Scroll down and select VS_nAribetF_atk1.wav. Press the Play button to listen to the sound Aribeth makes when attacking. This is actually a proprietary mp3 sound file but PCM wav files work as well.

Voicesets (.ssf or .utw)

At the next level up is a voiceset file that defines what sound files make up a complete group. This file includes a header and a series of standard sounds (0 through 48). For each standard sound there is a sound file name and corresponding string reference (STRREF) values (pointing to dialog.tlk).

  1. Open NWN Explorer.
  2. Select File | Open Neverwinter Nights.
  3. Select data/sounds.bif (you can also find some in data/sounds.bif) from NWN Main Data.
  4. Scroll down and select VS_nAribetF.
  5. Open it up to see what it looks like:

Note that the last column, Text Message, does not appear directly in the voiceset file. Instead, there is a String Reference number (STRREF) number. NWN takes this STRREF in the voiceset file and does a lookup of the text in the dialog.tlk. Why does NWN have the STRREF in the soundset file? These STRREF entries point to the custom text strings that appear above the character’s head when the sound fires off (a SpeakString). Not all sounds have a SpeakString (they are optional). No SpeakString, no text above the character’s head.

Voiceset files are always 1,216 bytes long. The resource names can refer to the names of any wav in data\voicesets.bif, data\sounds.bif, the /override directory or in a hakpak. (Need I say what I think about using the /override directory?)

Part 2: A Rose by any other Name

…works for voicesets. Almost.

There are up to 49 sounds in a voiceset. The order in which the sound name occurs in the voiceset file defines what NWN expects the sound to be. For example, the first sound in the voiceset file will always refer to a .wav that is fired off when your PC orders a familiar or henchman to attack the nearest creature.

We should be experts at using NWN Explorer by now. Let’s take a look at the different voiceset files.

  1. Open NWN Explorer.
  2. Select File | Open Neverwinter Nights.
  3. Select data/soundsets.bif from NWN Main Data.
  4. Scroll down and you can see all the sound files. They have names like VS_nAribetF_attk.wav, c_goblinK_bat1.wav.

The suffixes like '_attk' are just labels to help you quickly identify what type of the 49 potential sounds it is. You could give it any name you want but using these standard labels will make your voiceset much easier for others to understand.

Oh-oh. Sounds like I’m heading back to those pesky naming standards. You’re right.

Voiceset Type

The prefix helps to identify what type of voiceset it is. Use NWN Explorer to look at the soundsettypes.2da file. This shows you the 5 different types of voicesets. I have included in the chart below the standard prefix, and the number of sounds typically in one of the voiceset types.

Note
  • The official module in NWN only uses the Player, NPC Partial and Monster type codes. For example, if you look for the henchman voices in the official module they have the names VS_FAVHEN1F, VS_FAVHEN2F, VS_FAVHEN1M through VS_FAVHEN4M. But they are of type 3 (NPC Partial), not henchman. Weird, eh?
Type Target Standard Prefix # of Sounds
0 Player Character VS_f 49
1 Henchman VS_h 29
2 NPC Full VS_f 49
3 NPC Partial VS_n 21
4 Monster C_ 11

Sound Type

There are potentially a total of 49 sounds in a voiceset. The order in which the sound name occurs in the voiceset file defines what the sound is in NWN. The first sound in the voiceset file will always refer to a .wav that is fired off when your PC orders familiars/Henchman to attack nearest creature.

The order of the sounds in the ssf files are:

ID Extension Phrase 0 PC 1 Hench man 2 NPC Full 3 NPC Partial 4 Monster
0 *_attk Order to Attack
1 *_bat1 Battle Cry 1
2 *_bat2 Battle Cry 2
3 *_bat3 Battle Cry 3
4 *_heal Heal Me
5 *_help Help
6 *_enmy Enemies Spotted
7 *_flee Flee
8 *_tant Taunt
9 *_gard Guard Me
10 *_hold Hold Position
11 *_atk1 Attack 1
12 *_atk2 Attack 2
13 *_atk3 Attack 3
14 *_hit1 Hit 1
15 *_hit2 Hit 2
16 *_hit3 Hit 3
17 *_dyin Dyin
18 *_dead Dead
19 *_sick Sick
20 *_spel Spell Failure
21 *_inff Weapon Ineffective
22 *_foll Follow Me
23 *_look Look Here
24 *_grup Group Together
25 *_move Move Out Of Way
26 *_pick Pick Door/Trap
27 *_srch Search Here
28 *_hide Hide
29 *_can Can
30 *_cant Cant
31 *_done Done
32 *_encm Encumbered
33 *_slct Selected
34 *_hi Hi
35 *_yes Yes
36 *_no No
37 *_stop Stop
38 *_rest Lets Rest
39 *_bore Bored
40 *_bye Goodbye
41 *_thnk Thanks
42 *_haha Laugh
43 *_cuss Cuss
44 *_vict Victory
45 *_say Say
46 *_good Good Idea
47 *_bad Bad Idea
48 *_warn Warn
Notes
  • I don’t have any examples of Henchman or NPC Partial soundsets so I cannot vouch for the contents as indicated above (these definitions are from the original tutorial by Ddraigcymraeg).
  • The full name of your .wav file (minus the .wav) must be 16 characters or less.
  • Combat sounds like _atk1, _atk2, _hit1, _hit2 etc… do not display text in NWN so you do not need a STRREF for them.

It does not really matter if you don’t have all sound files in a voiceset for it to work. However, if a sound file is blank, it will not get fired off in the game scripts (at least it won’t crash the game). You can also re-use sound files (e.g., make row 12 and 13 refer to the same _atk1.wav file as you can find in row 11). Also, look around in the voiceset.bif file. You will find that Aribeth has more sound files than you can account for from this list (e.g., VS_nAribetF_468.wav) . This is because you also don’t have to limit your sound files to the list in a voiceset. These other sound files for Aribeth are triggered by the playsound() script command and other events in the game engine including the Other Actions tab in the dialogue editor.

Part 3: Updating Sound Files

Like the weapon tutorial, the easiest way to introduce your own voiceset into NWN is to replace existing content. This does not require any real changes and just asks that you rename your wav files to override existing content. We will look at more advanced techniques after this.

Let’s find a voiceset to replace.

  1. Open NWN Explorer.
  2. Select File | Open Neverwinter Nights.
  3. Select data/2da.bif from NWN Main Data.
  4. Scroll down and select the file soundset.2da. This file identifies all of the different voicesets in the game.
  5. Locate a voiceset you will probably not use in your campaign. AribetF – Aribeth – seems to be a popular choice. If you want to replace a male’s voice, try DestheM (Desther).
  6. The column you need to have is the one titled RESREF. This is the voiceset identifier. In this case, VS_nAribetF.
  7. Name all your wav files VS_nAribetF_<suffix>.wav. For example, VS_nAribetF_atk1.wav, VS_nAribetF_atk2.wav, etc.
  8. Load these files into a hakpak. Remember, the VS_n prefix tells NWN that this is an NPC Partial voiceset so you will need 21 wavs to fully replace the set.
  9. Now when you open your module, associate the Aribeth voiceset with your NPC and you can use your new sounds for this character.

This method only replaces an existing voiceset and it does have some shortcomings:

  • You cannot mix and match different voiceset sounds unless you want to copy the wav files multiple times. So you could not mix one character’s attack voice with another’s greeting.
  • The text that is displayed over a character’s head when she talks still uses the strings from the original voiceset.
If what you really wanted was a PC voiceset, stop here and use the technique I just showed you. Replace a voiceset that you won’t use. In the next section I will show you how to add an entirely new voiceset. However, the next method does not work for PC voicesets unless you use the /override directory. And by now you know how I feel about the /override directory. I’ll explain more at the end of that section as to why it doesn’t work.

Part 4: Creating a New Voiceset

Let’s address the concern with not being able to mix and match voiceset sounds. A better way to define a voiceset is to give it a resource definition of its own. This is similar to the process we used to give a weapon its own resource definition. What we want to do is define a new voiceset resource and create a new voiceset file (.ssf) to go with it. Let me show you the relationship between the different files we discussed earlier:

  • **** INSERT Flow Chart ****
  • Flow Chart for soundset.2da

Let’s start with the definition of the new resource. We are going to edit the soundset.2da file to define a new resource. Here is what the first few lines of the file look like:

2DA V2.0
       LABEL          RESREF        STRREF   GENDER   TYPE   
0      Aasimar        c_aasimar     8291     0        4      
1      Archhound      c_archhond    53091    0        4      
2      Archlant       c_archlant    53092    0        4      

Copy a line similar to the one we are going to add. In this case, let’s create an NPC voiceset. Copy the second last NPC voiceset definition (currently line 241) and paste it into the first User99 slot.

241    GendM          VS_nGENDM     53061    0        3      
242    ffightf_PCV    VS_ffightf    68489    1        0      
243    fkiller_PCV    VS_fkillerf   68490    1        0      
244    fseductf_pCV   VS_fseductf   68491    1        0      
245    fthugf_pcv     VS_fthugf     68492    1        0      
246    Kobold         c_kobold      2928     0        4      
247    KoboldChf      c_koboldchf   2929     0        4      
248    KoboldWiz      c_koboldwiz   2930     0        4      
249    Rat            c_rat         3022     0        4      
250    DireRat        c_direrat     3023     0        4      
251    Reserved01     ****          ****     ****     4      
252    Reserved02     ****          ****     ****     4      
253    Reserved03     ****          ****     ****     4      
254    Reserved04     ****          ****     ****     4      
255    Reserved05     ****          ****     ****     4      
256    McAul          VS_fMcAulM    68492    0        3      
257    User02         ****          ****     ****     4      

Here is what the fields mean:

Column Description Values
An integer ID# identifying the portrait internally. When choosing an ID for a .2da file, use one of the User99 rows.
LABEL The internal label for the voiceset.
RESREF Refers to the base voiceset name.
STRREF A reference to dialog.tlk giving the name of this voiceset. This is the name that will show up in the Aurora toolset or the character creation screen.
GENDER Uhm. Should be self-explanatory. This is used in the filter screens when selecting the voiceset (if you choose a female character, you only get female voices). The number comes from the first column in the 2da file gender.2da from the 2da.bif file (you can view the contents of this file using NWN Explorer as well).
0   Male
1   Female
2   Both
3   Other
4   None
TYPE The voiceset type that we described earlier. Again, this is important because it is used in the filters in NWN when displaying the voiceset selection screens. For example, unless you have a voiceset type of PC, you cannot select this voiceset for one of your characters in the character creation screens. 0 to 4.
Note
  • We would like to use **** for the RESREF to force the game engine to use the LABEL when displaying the new voiceset in the Aurora Toolset. But this does not work yet for soundset.2da.

Change the LABEL to McAul (our character’s name, who is male). Change the RESREF to VS_nMcAulM according to our naming standards earlier for the .wav files. Leave 68492 in the STRREF. Use 3 for the voiceset type because this is an NPC Partial voiceset. Well, that was easy enough. Now we have to create a VS_nMcAulM.ssf voiceset file.

  1. Open the ssfEditor.
  2. Type McAulMx into the Base Name field. This should be the name of the custom voiceset RESREF minus the sound set type prefix (i.e. minus VS_n or C_). SsfEditor wants you to use a 7 character name (NWN does not enforce this but go with the flow for now by adding an x at the end).
  3. Select NPC (vs_n) in the Soundset Type dropdown.
  4. Press New. ssfEditor enforces naming conventions for the NWN game engine by creating all 49 rows in the ssf file and appending the appropriate prefix and suffix to create each .wav file definition.
  5. Leaving the STRREF field blank for no SpeakString text. You can only update a row by pressing Update Sound.
  6. When you are finished, press Save. The name of the saved .ssf file MUST refer to the correct RESREF you added to the soundset.2da earlier (VS_nMcAulM.ssf, without the additional x).
Notes
  • When you close your module and reload it to bring up the new hakpak (remember we talked about this being the most reliable way of reloading a hakpak?), you won’t find your new soundset. Why not? For some reason the Aurora Toolset does not seem to reload the soundset.2da in this situation. You have to completely shut down the toolset and restart it.
  • Apparently a bug very similar to this was fixed for baseitems.2da in version 1.26 but the same error seems to persist for soundset.2da.
  1. Create or rename your 49 .wav files to VS_fMcAulMx_<suffix>.wav.
  2. Put your new soundsets.2da, VS_fMcAulM.ssf, and .wav files into a hakpak.
  3. Load the hakpak into your module.
  4. Create a new NPC in that module. Your new voiceset should be available as the voice for your character. Your voiceset will have the title of Female, Brutish Thug in the Aurora Toolset because of the STRREF you used earlier. Not that it is a female’s voice, just that this is what the STRREF points to in dialog.tlk.

This new voiceset still isn’t perfect. In the example above, we do not have any SpeakStrings tied to any of our sounds. Personally, I don’t find this a huge problem (if you look at the original game module closely, you will see that many NPCs use strings close to but not exactly the same as what they say). But if you want appropriate SpeakString text, look through the other voicesets and duplicate the STRREF entries there in your .ssf file. There are nearly 69,000 strings in dialog.tlk so at least one might come close.

You may be tempted to add your own SpeakStrings in the dialog.tlk file. Don’t do it! You are better off using a string similar to your dialog (even if not exactly the same) rather than distributing a modified dialog.tlk.

Okay, I promised you an explanation as to why this doesn’t quite work for PC voicesets. The problem is that in the character creation screen NWN has not loaded the module yet. Until it loads the module, NWN does not load any hakpaks from the module – including your soundset.2da file. Which means it does not know about the nifty new voiceset you added. Without this information, you cannot select the new voice from the character creation screen. Erk.

Currently, the only way to get a brand new voiceset into the character creation screen is to put the soundset.2da file in the /override directory. I really don’t like this method. I heartily recommend the previous method where you replace an existing voiceset. An alternate method is coming soon: Half-Elf has developed an independent Character Creator that builds character files outside of NWN. This allows you to do many things, including using new voice files for your PC.


« Character Portraits | Voice Sets | Items Without Models »


Main Page | CCG TOC

Personal tools