Insurgency Guide

Automatic radio filter and on/off beep effect for character voice mods for Insurgency

Automatic radio filter and on/off beep effect for character voice mods

Overview

Using FFmpeg and a Windows batch file to automatically filter many audio files and apply a beep on either end.

Prerequisites

Before proceeding, you will need FFmpeg, a free piece of software than can be used to process video and audio in a number of ways. You can download it here.[www.ffmpeg.org] You’ll also need to have its installation path registered in Windows in order for the batch script to work outside of FFmpeg’s installation folder, here’s a brief guide on how to do that.[video.stackexchange.com]

You’ll also need to have some sound assets to actually use. For radio static I recommend the one that comes with Insurgency’s VOIP system, which can be found in soundplayervoip_static_loop.wav, although note that it’s only about 7 seconds long and with this script FFmpeg won’t loop or stretch it to the length of your voice clip. If you need it, here’s some static looped for 30 seconds.[my.mixtape.moe] Likewise, you can use the game’s own radio beeps from either the VOIP effects or snipped from the original radio files. Just ensure any static or beep sounds you have in the same folder as the script and your voice clips are not .oggs, or they will be affected by the FFmpeg script later.

Folder setup

As it is now, the script is written with the assumption that itself, your beep/static sounds, and your voice clips are all in the same folder. This means you’ll need to cut and paste the script and its prerequisites around between the folders of sounds that you want, so just make sure you select and cut everything as you move them around.

Additionally, the batch script is reliant on two folders existing:

helper

Because FFmpeg cannot output on top of a source file and change the filesize, the script outputs from FFmpeg into a different folder, named helper, and then moves that on top of the original files and repeats as needed to ensure nothing is cut off and files come out the correct length. If this folder does not exist, the script will be unable to proceed and nothing will happen.

beeps

This folder is where you’ll put your end beeps. You can have any number of them as long as they are .oggs (and if they aren’t, just change the appropriate line in the batch script). If you don’t want to have your beeps randomized, you don’t need this folder.

With everything set up correctly, your work folder should look like this:

The batch script

Well, it should look like that minus the “radio.bat” at least. Make a new file, name it radio.bat or whatever tickles your fancy, and fill it with the following:

title Automatic Radio Effect – Step 1/3 for %%A in (*.ogg) do ffmpeg -y -i “%%A” -af “lowpass=f=2500,volume=3dB” “helper%%A” cd helper for %%A in (*.ogg) do move /Y %%A .. cd .. title Automatic Radio Effect – Step 2/3 for %%A in (*.ogg) do ffmpeg -y -i “%%A” -i static.wav -filter_complex amerge -ac 1 -q:a 4 “helper%%A” cd helper for %%A in (*.ogg) do move /Y %%A .. cd .. title Automatic Radio Effect – Step 3/3 SetLocal EnableDelayedExpansion Set “i=0” for %%A in (beeps*) do (set /A i+=1 set “file[!i!]=%%A”) for %%A in (*.ogg) do call :Process “%%A” goto :EOF :Process set /A “rand=(%RANDOM%%%i)+1” ffmpeg -y -i radio_beep.wav -i “%1” -i “!file[%rand%]!” -filter_complex “[0:a:0][1:a:0][2:a:0]concat=n=3:v=0:a=1[outa]” -map “[outa]” “helper%~nx1” cd helper for %%A in (*.ogg) do move /Y %%A .. cd ..

This version is written assuming you want to have an “on” beep and a randomly selected “off” beep. If you’d like your sounds to be closer to the originals, with no “on” beep and just a fixed “off” beep, use the following instead:

title Automatic Radio Effect – Step 1/3 for %%A in (*.ogg) do ffmpeg -y -i “%%A” -af “lowpass=f=2500,volume=3dB” “helper%%A” cd helper for %%A in (*.ogg) do move /Y %%A .. cd .. title Automatic Radio Effect – Step 2/3 for %%A in (*.ogg) do ffmpeg -y -i “%%A” -i static.wav -filter_complex amerge -ac 1 -q:a 4 “helper%%A” cd helper for %%A in (*.ogg) do move /Y %%A .. cd .. title Automatic Radio Effect – Step 3/3 for %%A in (*.ogg) do ffmpeg -y -i “%%A” -i radio_off.wav -filter_complex “[0:a:0][1:a:0]concat=n=2:v=0:a=1[outa]” -map “[outa]” “helper%~nx1” cd helper for %%A in (*.ogg) do move /Y %%A .. cd ..

Change any filenames, either of your files or in the script, as needed. If nothing is happening and you’re not sure why, run the script from a command line to see FFmpeg’s error output and that should help you pinpoint the issue.

That should be all there is to it. Cut and paste the script from folder to folder as needed and you’re all set.

Video demonstration

Here’s a quick video to show you how your folders and assets should be arranged and a quick before and after of the script at work.

SteamSolo.com