Left 4 Dead 2

Left 4 Dead 2

34 ratings
Jo's Bizzare Voicemodding
By Jo
This guide aims to ease the absolute tediousness of voicemodding survivors and promote the creativity it deserves.
   
Award
Favorite
Favorited
Unfavorite
Prelude
Before we start, i want you to know that my method will be very script heavy and will mostly rely on python and ffmpeg to do most of the work, so some level of familiarity with Python and a Terminal/CMD is required.

This is not a guide for complete newbies, if you are new to modding then i suggest you learn how to make a simple soundmod first.

Viewer's discretion is advised

Dependency
Info
Python[www.python.org]
Do make sure Add python.exe to PATH is checked, if you're setting it up.
ffmpeg & ffprobe [www.geeksforgeeks.org]
This ones gonna be a little tricky since it doesn't have an official installer, so just pay attention and follow the guide carefully.


Voicemodding Template
I already prepared a template beforehand for each survivor, you can grab the latest release in the release section of this github page.

vocal_template.7z[github.com]
(Just extract it and pick a survivor you want to mod, simple)

Incase you're not up to snuff with each survivor's internal name, its:
Francis | biker
Louis | manager
Zoey | teengirl
Bill | namvet
Nick | gambler
Ellis | mechanic
Rochelle | producer
Coach | coach
Sorting
For the sake of this tutural, we will be making a voicemod out of TF2 Pyro's voicelines for Rochelle.

  • To start off let's make a folder named after our <character>
    (This will be important later as we need to make things consistent for our script)


  • Then we simply start categorizing voicelines based on the context they should go in, i personally like to start with hurt lines.

#############################################

#############################################

Our distribution scripts is gonna require our samples to be named a certain way like so:


But that tends to get tedious fast, so i made a script for it.



(As a reminder, you need to keep your <character> consistent or else the script will fail to recognize your samples.)





  • Open up the survivor template you chose earlier, you should find a "massrn.py" in the utils folder, Then simply use the script like so:
Syntax:
python massrn.py <folder/directory> <character>





Here's neat trick if you want to quickly open a cmd prompt in your current directory.





Just enter "cmd" into the address bar and a cmd prompt will automatically open for that current directory.
Distribution Setup
Now that we have properly prepared our samples, Its time for the grand setup.

  • First off, dump your character folder into your survivor template.





Before we start the actual process, we would need to create a blank canvas so that the game won't play any voiceline we haven't altered yet.



  • So, grab "mute_vo.py" from utils folder and execute the script like so.
Oh... and do make sure its outside the utils directory or else the script will just throw you errors

Syntax:
python mutevo.py <survivor>





Allternatively, you can try Generic Sampling, which use placeholder samples instead of silence to fill the entire voicebank.

I'd like to call it Lazy Sampling because you can technically make a voicemod out of it, without ever altering another line, and call it a day.


but more on that later, now we have to tackle-


#############################################

#############################################



Remember why i sorted and processed those pain files back at Sorting?

Well time to unravel such mystery:
You see, we can't exactly distribute those samples without telling our script where to exactly put them, can we?




We need to make a dictionary for that.
( if you are confused what i meant by a "dictionary", basically its a list of audio files, which in context of this guide, are voicelines )
and if we give that list to the script, coupled with the samples we prepared earlier....
You get the picture?


But listing things is such a tedious task so as usual, i have already prepared a script for it.



  • dict.py should already be in the main directory so just use it as such

Since i put all of pyro's pain lines in the "pain" folder earlier, the name of our dictionary should also be "pain".

Syntax:
python dict.py <pattern> "<dictionary>"





You can also use regular expressions to input multiple patterns, i,e, "pattern1|pattern2"






You can open the dictionaries in notepad and exclude lines you don't want to be included, if you want.

Its really up to you on wether one should be and one shouldn't.










Side Note:

#############################################
To give more context, our upcoming distribution script assumes that we also named our files after the character folder, so the assumed file structure goes like this:

<character>\pain\<character>0.wav

Therefore....

pyro\pain\pyro0.wav

This is why we keep <character> consistent, you get me?
#############################################
Actual Distribution
Now that we have dictionaries out of the way, we can finally move on to-





Alright now, its all coming together.




  • Its already in main, staring you down, so simply use manuel.py to execute the manual distribution sampling and watch the magic unfold.

Syntax:
python manuel.py <dictionary> <character>



As a side note, if you are wondering how we are able to procure 16 voicelines with just 8 samples, well.... the script basically uses a Dynamic RNG System to distribute them, so you can literally generate hundreds of voicelines with just one audio clip.


Ain't that convenient?



If all is working as intended, you will find your distributed lines in a folder called man
so simply drop it in your survivor canvas once you're done using manuel.




I know what you might be asking




"So... do i have to match the project rate and duration in aud-"







Did i tell you we're gonna need that?
Are you seriously thinking of manually fixing thousands of voicelines?










No... we have a script for that.

[Optionyal] Generic Sampling
You can skip to "Voice Fixing"
This is mostly for the curious people who want to know what i meant by "Lazy Sampling" back at Sorting.


OK, the idea of this technique, is that we utilize Generic Voicelines to fill our voicebank instead of muting all of it.

"What the hell are generic voicelines?" you might ask.
To put it simply, these are placeholder lines that can work with any context, hence being Generic.
It can range from subtle coughing or laughter to vague answers or rhetorical questions.


Its not really necessary but it can add some character to voicelines you can't be bothered to manually fill.




  • To get started, we would want to make a "generic" category in our character.



  • Then we start sorting and sampling the generic voicelines, it doesn't really matter how many samples you actually put in it, i'd say.. 5-10 samples should be diverse enough.



  • Once that's over with, just simply use our gen_sample script, which can be found in our utils folder.
Syntax:
python gen_sample.py <survivor> <character>




If everything worked as god intended, you should find a complete survivor voicebank filled with your generic lines.



Voice Fixing
Contrary to popular belief, Rebuilding Soundcache still requires the audio files to have the proper sampling rate and channels.



Thankfully, we can just run this bad boy on any directory that contains them.

Syntax:
python fix_vo.py <directory>




Successful Messsage:



Or.... if you've already fixed your main voicelines and just want to implement changes you've distributed to man

You can just fix that and merge it with your survivor instead of fixing everything, everytime you want to make a change.




Testing
Now to actually test our mod ingame.




If you've ever tried an Uncut Release of one of my recent voicemods, you'd know that, that is the most effective and simple way of manually installing voicemods.

And if you've never tried them, don't worry, this section is for you.

  • Once your body is ready, simply download the provided installer template and drop it in your Left 4 Dead 2 folder as such.

installer_template.7z[github.com]



  • Then navigate to customvo\sound\player\survivor\voice and simply drop your survivor in.



  • and if everything went welll, simply Boot up L4D2 and execute loadaudio in the developer console



This will rebuild the soundcache for our customvo folder, so that we won't get any annoying audio glitches once we actually try our mod ingame.


  • Once its done loading, the game will automatically close itself and you are now free to test it.





Hmm... not bad

But you didn't exactly came here to just mod pain sounds, didn't you?
Well... now that you figured out how i make my voicemods, i think its about time you actually practice what you have learned here.
Now go out there and go crazy with your options.
Volume Adjustment

If you find your voices barely audible in actual gameplay then fret not.






I made a script for that.









i mean of course i did, why the hell would i be making this section in the first place?





  • Take out the adj_vol script from your utils folder and use it accordingly.

Fanum Tax:
python adj_vol.py <directory> <volume_level>




To give more context, <volume_level> should mean the number of times your directory has been amplified. so what i essentially did here was doubled the volume of my voicebank, which in most cases, should be enough for regular gameplay.

But if you feel like its not loud enough, then feel free to amp it up a bit.
The script should have also made a backup direcrory of your voicebank, for you to compare and start over again incase you weren't satisfied with the amplification.


Side Note:
And... No, you don't have to rebuild soundcache for volume, that's only for if you've changed a voiceline or two.


OH!-OH!-OH!-OH!-OH!-OH!






What if i wanted to de-amplify my voicebank instead?
Can i simply use a negative number?







Er... well.. Good question

No, you unfortunately can't use negatives for that.
Instead, what i figured out is that you can instead use lower volume levels to de-amplify your audio:




0.5 to lower it in half
0.25 to lower it drastically by 75%

and finally.... 0.01 to basically make it mute at this point






but i still think it should, i mean cmon why wouldn't it?....

ffmpeg really does get questionable at times.





Voice Correction

Once we are satisfied with our voicemod, i think its about time we shove them in a vpk and dump it into the creative skibidi toilet known as the........ Steam Workshop


But Jo...

you might ask



"Aren't you going to need to rebuild soundcache? I doubt you can simply pack the soundcache with it, considering the game never tries to read any soundcache metadata from vpks, right?"








But in all seriousness, yeah you're right, we simply can't pack our mods into vpks because even though they are already fixed, they don't actually match the durations of the original soundcache, which means we would still need to rebuild the cache.....







.....












But what if we don't have to?







  • Final piece of the puzzle, get your cmd prompts ready and use the correct_vo script accordingly.
Syntax:
python correct_vo.py <directory>





Now, if you're wondering what the hell this script even does, well... to put it simply:
It takes our voicebank and matches it with the duration of the original survivor voicebank.

Hence, removing the need to rebuild the soundcache entirely.




Although, there is a caveat in using this as the script really does match it to the duration of the original voicelines.

So, if the original voicelines was say.... 5 seconds long, the script will extend or cut your voiceline to match it. regardless if its in the middle of a sentence.





So this is why i tend to provide Uncut Releases for my voicemods.
for the people who can't seem to bear such crooked cuts reaching their sexy ears.


Or... alternatively: You can just use shorter samples to reduce the amount of badly cut voicelines, 0-2 seconds should be good, the shorter the better.





But if there's a voiceline, you just find too good to not mod in, then you can simply do it the good old fashioned way.
Browse your l4d2 folder and find an original voiceline that might match the duration of your voiceline, simple as.
33 Comments
igames Apr 22 @ 12:52pm 
Ah okay, gotcha. Sorry for the inconvenience.
Jo  [author] Apr 22 @ 12:49pm 
I train TTS models not voice conversion (RVC)......

Also, please talk about things in line with this guide, there will come a time where i divulge more on my AI antics but people aren't clearly ready yet if that's what they are thinking already.

Though i doubt my voicemodels are ready for public release.
igames Apr 22 @ 12:42pm 
Right, genuine question - so how do you manage to CONVERT all the voicelines as a example? I'm aware of the RVC stuff, but converting all to certain characters takes a long time, does it? Do I just slap the whole folder in or upload each voice one by one?

What I'm trying to do, is convert Nick's voice to Megaman X4 Zero's voice, and do I have to use RVC tool to convert the WHOLE folder of it? My laptop is unfortunately weak and not like a "gaming" type equipment...
reina Apr 4 @ 3:14am 
it appeared i missed the very first image in Distribution setup, had the contents of my character folder inside the voice template folder which caused dict.py (and thus manuel.py) to act funny. remember to re-read a lot if you get stuck, kids :dustpan:
nu ok Mar 31 @ 3:09pm 
:roflanFace:
Jo  [author] Mar 26 @ 7:43am 
wdym? if you wanted to commission me you could have just said so in my profile instead
PacoYoshi Mar 26 @ 7:34am 
Is there a commission here?
Jo  [author] Mar 25 @ 10:56pm 
you can easily find voicedata from vgresources, if not, try figuring out how to extract them from their respective game.
zatty Mar 25 @ 10:25pm 
Nice tutorial.

How did you get Pyros voice?

Like i want to use Jill valentines voice to zoey and rochelle voice
Jo  [author] Mar 24 @ 7:46am 
i don't know jack sh*t about python neither before i started this project lol

all of these were initially writen in shell back in 2021, i just used my vague knowledge of OOP and chatgpt to port these to a more accessible language.

> what do you allow people to do with it?

Its GPL3, so do whatever the hell with it as long as its not going into a proprietary project.

> would you mind if for example people left in the .py and the meta folder inside the .vpk due to sheer laziness lol.

i would generally encourage people to upload less bloat as possible, valve is letting us use their servers for free and they can take that privilege away if they wanted.