How to mute and replace ped speech.
If you watch this video closely, it's over in a blink of an eye, you will see Michael speaking with facial and body animations but no sound coming out of his mouth. The idea behind this? Replace game speech with your own speech but with a twist. I'm not attempting to replace the game sound files. Instead I'm muting them and substituting them with sound files in my scripts folder (not in the mods or games, so not a true replacement).
Here is the proof of concept process. I'm indebted to @a63nt-5m1th, our resident expert/guru for walking me through the file export to OAC and subsequent processing in Audacity.
- Identify the sound bite (.wav file) in its library (.awc) using Open IV search.
- Export to Open Formats to your HDD. This will give you a folder full of .wav files and 1 OAC file.
- Selectively or bulk edit the files in Audacity. Select the audio (ctrl A) and then from the main menu, select Effects, then Amplify and move the slider all the way to the left to mute the track or tracks (-50db).
- Export the wav or wavs from Audacity as the default 16 bit PCM mono - so that they overwrite/replace the original wavs.
- From Open IV, drag the OAC back. It will take the folder containing the wavs back with it and overwrite the original awc (so backup if necessary, but use your Mods folder).
- You can play the now muted sound, keeping the animations like this:
Function.Call(Hash._PLAY_AMBIENT_SPEECH_WITH_VOICE, PP, "FIGHT", "a_f_y_beach_01_white_full_01", "Speech_Params_Standard", 0);
- You can replace the sound using naudio like this
var PlayMP3 = new Mp3FileReader("./scripts/MySounds/replacement.mp3");
var PlayOut = new WaveOut();
Note, you can use mp3 or wav for your replacement.
This is NOT shown in video. Will demo it later. In passing you could do this in a video editor like DVR 17 but it would take quite a bit of work compared to this one take, no edit method. In fact, it might be next to impossible to isolate the speech from ambient game noises and music if they are all on the same audio track.
Ok bad news and great news. First the bad news, I wasn't able to play a replacement sound over the muted sound, which in retrospect is perfectly logical and reminds me not to experiment late at night.
The great news? I was able to replace the original game sound with my own clip effortlessly in a few seconds.
Again, thanks go out to @a63nt-5m1th for his export to Open Formats solution.
So here are the steps.
- Once you have muted the wav file in Audacity as per the instructions in post above and saved it, you can now reopen it and give it a second pass if necessary to completely mute the file (select all, effects, amplify, slider to the left).
- Now Import your replacement file (same wav format) and trim any excess because the files have to be identical in duration. Audacity draws a nice neat line where the file ends, so it's super easy to match them up.
- You now have three tracks - the original muted wav from the game and two tracks from the replacement wav (unless you recorded the replacement in mono). From Audacity you split stereo to mono because you need a mono file, and save it.
- As per the instructions above, you drag the oac back into Open Four. That's it, your done!
The video below was just a super quick and dirty proof of concept, so the synch is not there, but that was expected given I didn't make any effort to get a similar wav, just chose a random one, and a female voice for Michael! If anyone needs more details, just ask.