Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# Usage: gog_system_shock_demo_extract_music.sh <data_dir>
#
# The script relies on these utilities:
# 1. Wwise BNK File Extractor.
# Source: https://github.com/eXpl0it3r/bnkextr
#
# 2. sox
#
# The script assumes, extractor tool is placed in ${HOME}/bin/extractors
# override this variable when running the script if you placed it elsewhere or it's named differently.
# bnk_extractor=<location> gog_system_shock_demo_extract_music.sh <data_dir>
#
# For the Linux version, music directory is StreamingAssets/Audio/GeneratedSoundBanks/Linux
# i.e. from the data dir which is game/systemshockdemo_Data from the game path.
#
# The script assumes you are running it on Linux by default and takes data directory as parameter.
# Override music_path variable if you have some other music subdir (which seems to be OS specific).
# music_dir=<location> gog_system_shock_demo_extract_music.sh <data_dir>
music_dir=${music_dir:-"StreamingAssets/Audio/GeneratedSoundBanks/Linux"}
bnk_extractor=${bnk_extractor:-"${HOME}/bin/extractors/bnkextr"}
data_dir="$1"
extract_dir="tmp_extract_wem"
result_dir="result_wav"
mkdir -p $extract_dir
mkdir -p $result_dir
cd $extract_dir
$bnk_extractor "${data_dir}/${music_dir}/Music.bnk"
for source in *.wem; do
sox --type raw --rate 44100 --encoding signed --endian little --bits 16 --channels 2 "$source" "../${result_dir}/${source%%.*}.wav"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment