Jump to content

Sound replacement possible?


TRekNexus

Recommended Posts

tracktwo, excellent work -- way to break some new ground.

 

I'd be interested in including some new voicesets for Long War -- specifically, English with male and female English, Australian, Scottish, Irish and South African accents. I know that's a tall order -- the enum eCharSpeech shows some 85 separate entries (some of which many not be used, and some may have multiple voice segments for the same bit of speech), and we'd want the sound and voice quality somewhere above amateurish levels as well as matching whatever other audio characteristics the vanilla voicesets possess, so it integrates as seamlessly as possible.

 

This will probably take someone who is able to handle sound recording and processing as well as voice actors with the proper accent.

 

Is this technically possible at this point? I can put out a call for contributions on the Long War page and on Reddit. Way back when, this guy: http://www.escapistmagazine.com/articles/view/video-games/columns/extra-punctuation/10029-Save-Scummer volunteered to make voice sets, so I can reach out to him and see if he's still willing (nearly two years after this post). What exactly would I need to ask for -- a bunch of ogg files, yes? And would you be willing and able to assemble them into a usable file?

Edited by johnnylump
Link to comment
Share on other sites

  • Replies 199
  • Created
  • Last Reply

Top Posters In This Topic

I believe this is technically possible now, yes. There are still a few things I don't fully understand with my additional language mod, namely the customization cues don't play to give you a "sample" of the voice when you choose it in the UI, and the game also doesn't appear to be correctly determining the correct number of available voices for female soldiers. I'm still looking into those things and I think they're both solvable problems, via scripts if nothing else.

 

It may be easier to actually implement the accented voices as a new language as opposed to a new voice in the english language, but both should be possible. The advantages of using a new language is that it might be simpler to handle the mapping from country to language on soldier creation if that option is enabled. It would also avoid "normal" english soldiers from picking up the accented voices when they choose their random default english voice. I've had success in adding a new language, I haven't yet tried extending the ECharacterVoice enum.

 

As for the format, .WAV files is probably best. It's easier to create the packages by importing them into the UDK, and it only imports WAV and does the conversion to ogg on cooking. And I'd definitely be willing to do the packaging.

Link to comment
Share on other sites

Okay, great! A new "language" (or even multiple languages) would be fine for this. Also, we have been able to extend XGGameData enums without problem. (XGTacticalGameCore enums are another matter).

 

Three more questions:

* What .wav format does XCOM use? ( I refer to the list about 3/4 of the way down this page: http://en.wikipedia.org/wiki/WAV)

 

* Are you able to handle multiple wavs for a single voice, uh, segment (Not sure what the term of art is ... I mean each one of the entries in eCharSpeech_Confirmed ... "confirmed" may have several variations for single voice).

 

* Anything else I should relay to potential voice actors? What could mess up their audio? (echo from a bad room, mic popping, anything else?) This is all new to me.

Link to comment
Share on other sites

I was looking into this a bit in case modding in some more mod-ability was needed, and it looks like adding new voice packs for other nationalities (e.g. British, Australian, South African, Japanese, etc) might be a little tricky.

 

It seems that Character languages are defined in XGGameData via :

enum ECharacterLanguage
{
    eCharLanguage_English,
    eCharLanguage_French,
    eCharLanguage_German,
    eCharLanguage_Italian,
    eCharLanguage_Polish,
    eCharLanguage_Russian,
    eCharLanguage_Spanish,
    eCharLanguage_MAX
};

Note that only the languages supported in vanilla EW are even on the list.

 

There's a function in XGCharacterGenerator that maps from the 3-letter language string used by Unreal Engine to this enum :

 

 

static function XGGameData.ECharacterLanguage GetLanguageByString(optional string strLanguage)
{
    strLanguage = "";
    if(Len(strLanguage) == 0)
    {
        strLanguage = GetLanguage();
    }
    switch(strLanguage)
    {
        case "DEU":
            return 2;
        case "ESN":
            return 6;
        case "FRA":
            return 1;
        case "ITA":
            return 3;
        case "POL":
            return 4;
        case "RUS":
            return 5;
        default:
            return 0;
    }
} 

 

 

 

Now, in general the enum could be extended and the GetLanguageByString function extended. There's also a function "GetLanguageByCountry" in XGCharacterGenerator, which could also be extended.

 

The problem is that in GetNextMaleVoice and GetNextFemaleVoice, the ECharacterLanguageEnum value is passed to a native function : XComContentManager.GetPossibleVoices, which has as a prototype :

native function GetPossibleVoices(XGTacticalGameCoreNativeBase.EGender Gender, int LanguageIdx, bool bIsMec, out array<XGGameData.ECharacterVoice> VoiceIds);

New the VoiceIDs returned are simple enums, which I think happens because different languages might have different number of voicepacks (e.g., there might be 7 male english voices, but only 6 male german voices, for example).

 

The actual voice content is loaded in XComHumanPawn. The voice content load request is handled in XComHumanPawn.RequestFullPawnContent via :

        if(m_kAppearance.iVoice != -1)
        {
            kRequest.eCategory = 7;
            kRequest.iID = m_kAppearance.iVoice;
            kRequest.iSubID = m_kAppearance.iLanguage;
            m_kVoiceRequest = kRequest;
        }

which specifies the voice enum (from iVoice) and the language (from iLanguage) to be loaded.

 

The content is loaded in XComHumanPawn.MakeAllContentRequests, which has a specific line to request the voice content (as opposed to all of the other pawn content such as head, hair, weapons, armor, armor kit) :

    XComContentManager(class'Engine'.static.GetEngine().GetContentManager()).RequestContentArchetype(m_kVoiceRequest.eCategory, m_kVoiceRequest.iID, m_kVoiceRequest.iSubID, self, OnFullPawnContentLoaded, bAsync);

XComContentManager.RequestContentArchetype is a native function with prototype :

// Export UXComContentManager::execRequestContentArchetype(FFrame&, void* const)
native final function RequestContentArchetype(XComContentManager.EContentCategory ContentType, int Id, optional int SubID, optional Object CallbackObject, optional delegate<OnArchetypeLoaded> Callback, optional bool bAsync)
{
    SubID = -1;        
    bAsync = false;                                
}

The various language alternatives don't appear to be configurable via the DefaultContent.ini file.

 

Looking at the various language voices, they are very regular, so I suspect that the appropriate voicebank upk name is generated algorithmically.

 

The format generally seems to be :

<optional string 'Mec'> + <'Male' or 'Female'> + <Voice bank number, '1', '2', etc> + '_' + <Language string, 'English', 'German', 'Polish', 'Russian', etc>
Link to comment
Share on other sites

johnnylump: The UDK can import wav files in 16-bit PCM format. The existing voices are generally mono, 22050Hz. A single "voice" in X-Com typically contains 15 variations. These are the voice banks, and that's how the game will randomize exactly which clip you'll hear on any given event. I don't know this 100%, but I strongly suspect they all follow the same "script", at least in english. As in, each of the 6 male and female voices have the same wording for the variations. Like "overwatch, aye aye", "overwatch", "on overwatch", "I've got my eyes on", etc. So a single new voice will actually be several hundred individual clips for all the banks across all the needed sound events.

 

As far as recording techniques, I'm not really an expert on that. Maybe the YouTube LPers would know more about good recording setups?

 

amineri: Yes, it looks to be the case that the voices are mapped per language by the executable algorithmically, but I discovered last weekend that this is just setting the defaults and they can be overridden with VoicePackageInfo lines in the defaultcontent.ini file. The existing entries for VoicePackageInfo just set the voice enum value, but the structure itself also has fields for language and whether or not the voice is for a mec. My first experiment simply added VoicePackageInfo lines for english, but set the voice archetype to voices for other languages. In game, all my "english" soldiers were speaking french, german, and italian.

 

Next, I created a new language enum value and added VoicePackageInfo lines for this new language. I used two voice archetypes for each gender: Zhang/Annette and the blueshirts. This also works, and is selectable through the UI with a localizable language string, but it did have a couple of quirks I'm still researching. First, for the male voices it correctly determined there were only two voices and clicking the spinner arrows would cycle only between voice 1 and 2 in that language. For females, it cycles through all 6. The UI figures out how many voices there are by looking at the possible voices array, originally returned by GetPossibleVoices, so it looks like its behaving differently for the two genders. The second problem is there is no sample sound playing when you select the voice in the UI for the dlc/blueshirt voices. I think I know why this is but need to work a bit more on it.

Link to comment
Share on other sites

So 15 clips for each of these? Some of these are so rarely used I find that difficult to believe.

 

Sorry I'm being pedantic here; if I get volunteers I don't want them doing a bunch of work that will never get used. I suppose I can try to do observations ingame on how many different clips are used for each enum.

 

 

 

enum ECharacterSpeech
{
eCharSpeech_Confirmed,
eCharSpeech_HunkerDown,
eCharSpeech_Reload,
eCharSpeech_Overwatching,
eCharSpeech_Moving,
eCharSpeech_Dashing,
eCharSpeech_JetPackMove,
eCharSpeech_LowAmmo,
eCharSpeech_OutOfAmmo,
eCharSpeech_Suppressing,
eCharSpeech_AreaSuppressing,
eCharSpeech_PaintingTarget,
eCharSpeech_DestroyingCover,
eCharSpeech_FlushingTarget,
eCharSpeech_HealingAlly,
eCharSpeech_StabilizingAlly,
eCharSpeech_RevivingAlly,
eCharSpeech_CombatStim,
eCharSpeech_PrimingGrenade,
eCharSpeech_FragOut,
eCharSpeech_SmokeGrenadeThrown,
eCharSpeech_SpyGrenadeThrown,
eCharSpeech_FlashbangThrown,
eCharSpeech_FiringRocket,
eCharSpeech_GhostModeActivated,
eCharSpeech_CollateralDamage,
eCharSpeech_JetPackDeactivated,
eCharSpeech_ArcThrower,
eCharSpeech_RepairSHIV,
eCharSpeech_Kill,
eCharSpeech_MultiKill,
eCharSpeech_Missed,
eCharSpeech_TargetSpotted,
eCharSpeech_TargetSpottedHidden,
eCharSpeech_HeardSomething,
eCharSpeech_TakingFire,
eCharSpeech_FriendlyKilled,
eCharSpeech_Panic,
eCharSpeech_PanickedBreathing,
eCharSpeech_Wounded,
eCharSpeech_Died,
eCharSpeech_Flanked,
eCharSpeech_Suppressed,
eCharSpeech_ElectroPulse,
eCharSpeech_PsiControlled,
eCharSpeech_Flamethrower,
eCharSpeech_JetBoots,
eCharSpeech_KineticStrike,
eCharSpeech_OneForAll,
eCharSpeech_MeldSpotted,
eCharSpeech_MeldCollected,
eCharSpeech_CivilianRescued,
eCharSpeech_AlienRetreat,
eCharSpeech_AlienMoving,
eCharSpeech_AlienNotStunned,
eCharSpeech_AlienReinforcements,
eCharSpeech_AlienSighting,
eCharSpeech_RunAndGun,
eCharSpeech_ProximityMine,
eCharSpeech_PrecisionShot_DEPRECATED,
eCharSpeech_DisablingShot,
eCharSpeech_Executioner_DEPRECATED,
eCharSpeech_DoubleTap_DEPRECATED,
eCharSpeech_InTheZone_DEPRECATED,
eCharSpeech_ShredderRocket,
eCharSpeech_HotPotato_DEPRECATED,
eCharSpeech_PsionicsMindfray,
eCharSpeech_PsionicsPanic,
eCharSpeech_PsionicsInspiration,
eCharSpeech_PsionicsTelekineticField,
eCharSpeech_GrapplingHook,
eCharSpeech_GainingElevation_DEPRECATED,
eCharSpeech_GenericResponse,
eCharSpeech_SoldierControlled,
eCharSpeech_StunnedAlien,
eCharSpeech_Explosion,
eCharSpeech_RocketScatter,
eCharSpeech_PsiRift,
eCharSpeech_Poisoned,
eCharSpeech_HiddenMovement,
eCharSpeech_HiddenMovementVox,
eCharSpeech_CriticallyWounded_DEPRECATED,
eCharSpeech_ExaltChatter,
eCharSpeech_Strangled,
eCharSpeech_COUNT,
eCharSpeech_MAX
};

[/sPoiler]

Link to comment
Share on other sites

Not pedantic, the actual voice assets are going to be the biggest chunk of work for sure. To clarify:

 

A voice consists of n voice banks. In all the packages I've looked at for xcom, n is always 15. But the bank count is dynamic and it's entirely possible that the game will load and deal with other values for n, and banks can always be repeated to fill smaller values out to 15 in case that is actually needed.

 

In a single voice bank, there is a list of sound cues mapping to those event types you listed. To be more precise, they map to the cue variables in the character voice class. I'll pull out the full list when I get home tonight. Lots of the ones in the enum are marked deprecated and are probably not necessary.

 

Also, not every sound cue needs to be present in every bank. For example, mecs have unique sounds associated with them. The banks for humans don't need entries for these. I will check when I get home tonight if all banks have all the cues that are relevant for that soldier type. Like you say, some are rarely used so while you might want 15 distinct "moving" cues, you probably don't really need 15 RocketScatter sounds, so I would not be shocked if some of those banks don't have the more infrequently used cues. Again, in the worst case and the game insists on everything being present in every bank, individual clips could be re-used.

 

As a first step and proof of concept I think one of each, or even one just containing some of the more common ones would be a great starting point. From my experiments, what usually happens with missing sounds is the game still works but the missing sounds obviously just don't play. So even a mostly empty single-bank voice would probably be plenty to get started, and it can be filled out over time.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...