Skip to content

Instantly share code, notes, and snippets.

@shmerl
Last active January 8, 2022 17:40
Show Gist options
  • Save shmerl/1490220a8786eb7f9c29b2dfe904b6fd to your computer and use it in GitHub Desktop.
Save shmerl/1490220a8786eb7f9c29b2dfe904b6fd to your computer and use it in GitHub Desktop.
#!/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