csgo-voice-extractor
csgo-voice-extractor copied to clipboard
CLI to export players' voices from CSGO demos into WAV files.
Counter-Strike voice extractor
CLI to export players' voices from CSGO/CS2 demos into WAV files.
[!WARNING]
Valve Matchmaking demos do not contain voice audio data, hence there is nothing to extract from MM demos.
Installation
Download the last release for your OS from GitHub.
Usage
Windows
csgove.exe demoPaths... [-output]
By default .dll files are expected to be in the same directory as the executable.
You can change it by setting the LD_LIBRARY_PATH environment variable. Example:
LD_LIBRARY_PATH="C:\Users\username\Desktop" csgove.exe
macOS
[!CAUTION]
The environment variableDYLD_LIBRARY_PATHmust be set before invoking the program and point to the location of the.dylibfiles!
DYLD_LIBRARY_PATH=. csgove demoPaths... [-output]
Linux
[!CAUTION]
The environment variableLD_LIBRARY_PATHmust be set before invoking the program and point to the location of the.sofiles!
LD_LIBRARY_PATH=. csgove demoPaths... [-output]
Options
-output <string>
Folder location where audio files will be written. Current working directory by default.
-exit-on-first-error
Stop the program at the first error encountered. By default, the program will continue to the next demo to process if an error occurs.
Examples
Extract voices from the demo myDemo.dem in the current directory:
csgove myDemo.dem
Extract voices from multiple demos using absolute or relative paths:
csgove myDemo1.dem ../myDemo2.dem "C:\Users\username\Desktop\myDemo3.dem"
Change the output location:
csgove -output "C:\Users\username\Desktop\output" myDemo.dem
Developing
Requirements
- Go
- GCC
- Chocolatey (Windows only)
Debugging is easier on macOS/Linux 64-bit, see warnings below.
Windows
Because the CSGO audio library is a 32-bit DLL, you need a 32-bit GCC and set the Go env variable GOARCH=386 to build the program.
[!IMPORTANT]
Use a unix like shell such as Git Bash, it will not work withcmd.exe!
[!WARNING]
The$GCC_PATHvariable in the following steps is the path wheregcc.exeis located.
By default, it'sC:\TDM-GCC-64\binwhen using TDM-GCC (highly recommended).
- Install
GCCfor Windows, TDM-GCC is recommended because it handles both 32-bit and 64-bit when runninggo build. If you use MSYS2, it's important to install the 32-bit version (pacman -S mingw-w64-i686-gcc). - Install
pkg-configusing chocolatey by runningchoco install pkgconfiglite.
It's highly recommended to usechocootherwise you would have to buildpkg-configand copy/paste thepkg-config.exebinary in your$GCC_PATH. - Download the source code of Opus
- Extract the archive, rename the folder to
opusand place it in the project's root folder - Open the
opus/win32/VS2015/opus.slnfile with Visual Studio (upgrade the project if asked) - Build the
Releaseconfiguration forWin32(notx64- it's important to build the 32-bit version!) - Copy/paste the
opus.dllfile in$GCC_PATHanddist/bin/win32-x64 - Copy/paste the C header files located inside the
includefolder file in$GCC_PATH\include\opus(create the folders if needed) - Copy/paste the
opus.pc.exampletoopus.pcfile and edit theprefixvariable to match yourGCCinstallation path if necessary. PKG_CONFIG_PATH=$(realpath .) LD_LIBRARY_PATH=dist/bin/win32-x64 CGO_ENABLED=1 GOARCH=386 go run -tags nolibopusfile .
[!WARNING]
Because the Go debugger doesn't support Windows 32-bit and the CSGO lib is a 32-bit DLL, you will not be able to run the Go debugger.
If you want to be able to run the debugger for the Go part only, you could comment on lines that involveC/CGOcalls.
macOS
[!IMPORTANT]
On macOSARM64, thex64version of Homebrew must be installed!
You can install it by addingarch -x86_64before the official command to install Homebrew (arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)")
- Install Homebrew x64 version
arch -x86_64 brew install opusarch -x86_64 brew install pkg-configcp /usr/local/Cellar/opus/1.4/lib/libopus.0.dylib dist/bin/darwin-x64(arch -x86_64 brew info opusto get the path)DYLD_LIBRARY_PATH=dist/bin/darwin-x64 CGO_ENABLED=1 GOARCH=amd64 go run -tags nolibopusfile .
[!WARNING]
On macOS ARM64, the Go debugger breakpoints will not work because the executable must target amd64 but your OS is ARM64.
Linux
sudo apt install pkg-config libopus-devcp /usr/lib/x86_64-linux-gnu/libopus.so.0 dist/bin/linux-x64(you may need to change the path depending on your distro)LD_LIBRARY_PATH=dist/bin/linux-x64 CGO_ENABLED=1 GOARCH=amd64 go run -tags nolibopusfile .
Building
Windows
make build-windows
macOS
make build-darwin
Linux
make build-linux
Credits
Thanks to @saul and @ericek111 for their CSGO investigation.
Thanks to @DandrewsDev for his work on CS2 voice data extraction.