Skip to content

Commit

Permalink
merge of two git repos for fallout games
Browse files Browse the repository at this point in the history
merge of git repo's:
https://github.com/suglasp/pwsh_convert_wav_to_mp3
https://github.com/suglasp/pwsh_convert_xwm_to_wav

Can be used for extracting and converting Fallout4 and Fallout76 game sfx/music files.
  • Loading branch information
suglasp authored Feb 25, 2020
0 parents commit f4d5c45
Show file tree
Hide file tree
Showing 5 changed files with 234 additions and 0 deletions.
41 changes: 41 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Fallout 4 and Fallout 76 sfx and music conversion kit for PC.

Steps:
Step 1) -> this takes the longest and most manual work. This will generate a lot of Gigabytes of data!
Download BAE tool here https://www.nexusmods.com/fallout4/mods/78/?
Make a folder for file extraction, for example "C:\Extracted"

Browse to the Fallout 4 or Fallout 76 Intallation folders.
This depends if you use the Bethesda launcher or Steam for each game.
Currently, FO4 is only available on Steam. FO76 is only available through the Bethesda launcher.
FO76 will be available on Steam from April 2020.

Anyway, nativate for each game to the <install folder>\Data.
Locate each *.ba2 files.
For FO76, you want the files:
- SeventySix - Sounds01.ba2
- SeventySix - Sounds02.ba2
- SeventySix - Voices.ba2
- SeventySix - Startup.ba2
- SeventySix - ??UpdateStream.ba2 (Where ?? is a double number from 00, 01, 02 to .. for each update)

Extract with BAE for each ba2 file, the sounds and music packed folders.
For each ba2 file, i create a sub folder with the same name under "C:\Extracted".

Step 2) -> prepare for conversion of xmp files to wav/mp3
Copy convert_wav_to_mp3.ps1 and convert_xwm_to_wav.ps1 to "C:\Extracted"
Make a subfolder "C:\Extracted\ffmpeg"
Make a subfolder "C:\Extracted\xWMAEncode"

Download xWMAEncode.exe to "C:\Extracted\xWMAEncode" from https://www.nexusmods.com/skyrim/mods/32075/?tab=files
Download ffmpeg static for Windows to "C:\Extracted\ffmpeg" from https://ffmpeg.zeranoe.com/builds/

Step 3) -> follow each step as described. This will generate a lot of Gigabytes of data!
Start powershell
Set-Location C:\Extracted
.\convert_xwm_to_wav.ps1 <- this converts all *.xmp to *.wav files (raw)
.\convert_wav_to_mp3.ps1 <- this converts all *.wav to *.mp3 files (compressed)


Have fun,
Pieter De Ridder
99 changes: 99 additions & 0 deletions convert_wav_to_mp3.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@

#
# Pieter De Ridder
# Script to convert wav to mp3 in a loop
#

# Global vars
$global:WorkingDir = $($PSScriptRoot)
$global:WorkingDirFFMPEG = "$($global:WorkingDir)\ffmpeg\bin"
$global:ffmpeg = "$($global:WorkingDirFFMPEG)\ffmpeg.exe"


#
# Function : Convert-ToMP3
# Convert wav file to mp3 with ffmpeg.exe
#
Function Convert-ToMP3 {

Param(
[string]$WAVFile
)

If (Test-Path $global:ffmpeg) {
If (Test-Path $WAVFile) {
If ($WAVFile.EndsWith(".wav")) {
$sOutputPath = Split-Path $WAVFile -Parent

$sOutputFile = (Split-Path $WAVFile -Leaf)
$sOutputFile = $sOutputFile.Substring(0, ($sOutputFile.Length -3)) + "mp3"

$sOutput = "$($sOutputPath)\$($sOutputFile)"

If (-not (Test-Path $sOutput)) {
$arrArgs = @()
$arrArgs += "-i"
$arrArgs += "$([char]34)$($WAVFile)$([char]34)"
$arrArgs += "-vn"
$arrArgs += "-ar"
$arrArgs += "44100"
$arrArgs += "-ac"
$arrArgs += "2"
$arrArgs += "-b:a"
$arrArgs += "192k"
$arrArgs += "$([char]34)$($sOutput)$([char]34)"

Write-Host "Generating $($sOutputFile)..."
$p = Start-Process -FilePath $global:ffmpeg -WorkingDirectory $global:WorkingDirFFMPEG -ArgumentList $arrArgs -NoNewWindow -Wait -PassThru

if ($p.ExitCode -eq 0) {
Write-Warning "ffmpeg : success"
} else {
Write-Warning "ffmpeg : failed?"
}
} else {
Write-Warning "$($sOutput) already exists."
}
} else {
Write-Warning "$($WAVFile) not a wav file?"
}
}
} else {
Write-Warning "FFMPEG missing?!"
}
}


#
# Function : Convert-WavBulk
# Convert wave files in bulk to mp3
#
Function Convert-WavBulk {
Param (
[string]$Root
)

Write-Host "Indexing files in $($Root)..."

If (Test-Path $Root) {
$arrWavFiles = @((Get-ChildItem -Path "$($Root)" -File -Filter *.wav -Recurse).FullName)

If ($arrWavFiles.Length -gt 0) {
Write-Host "Starting conversion of files..."
ForEach($WavFile in $arrWavFiles) {
Convert-ToMP3 -WAVFile $WavFile
}
} else {
Write-Warning "No files found?"
}
} else {
Write-Warning "$($Root) path not found?"
}
}

#
# convert all wav files in folder 'in-place' to mp3 files.
# .wav files get converted, serial wise a.k.a. synchronious, to .mp3.
# the output mp3 file is placed next to the existing wav file.
#
Convert-WavBulk -Root ".\"
91 changes: 91 additions & 0 deletions convert_xwm_to_wav.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@

#
# Pieter De Ridder
# Script to convert Xwm to wav in a loop
#

# Global vars
$global:WorkingDir = $($PSScriptRoot)
$global:WorkingDirxWMAEnc = "$($global:WorkingDir)\xWMAEncode"
$global:xWMAEnc = "$($global:WorkingDirxWMAEnc)\xWMAEncode.exe"


#
# Function : Convert-ToWav
# Convert xwm file to wav with xWMAEncode
#
Function Convert-ToWav {

Param(
[string]$XwmFile
)

If (Test-Path $global:xWMAEnc) {
If (Test-Path $XwmFile) {
If ($XwmFile.EndsWith(".xwm")) {
$sOutputPath = Split-Path $XwmFile -Parent

$sOutputFile = (Split-Path $XwmFile -Leaf)
$sOutputFile = $sOutputFile.Substring(0, ($sOutputFile.Length -3)) + "wav"

$sOutput = "$($sOutputPath)\$($sOutputFile)"

If (-not (Test-Path $sOutput)) {
$arrArgs = @()
$arrArgs += "$([char]34)$($XwmFile)$([char]34)"
$arrArgs += "$([char]34)$($sOutput)$([char]34)"

Write-Host "Generating $($sOutputFile)..."
$p = Start-Process -FilePath $global:xWMAEnc -WorkingDirectory $global:WorkingDirxWMAEnc -ArgumentList $arrArgs -NoNewWindow -Wait -PassThru

if ($p.ExitCode -eq 0) {
Write-Warning "xWMAEnc : success"
} else {
Write-Warning "xWMAEnc : failed?"
}
} else {
Write-Warning "$($sOutput) already exists."
}
} else {
Write-Warning "$($XwmFile) not a xwm file?"
}
}
} else {
Write-Warning "xWMAEncode missing?!"
}
}


#
# Function : Convert-XwmBulk
# Convert xwm files in bulk to wav
#
Function Convert-XwmBulk {
Param (
[string]$Root
)

Write-Host "Indexing files in $($Root)..."

If (Test-Path $Root) {
$arrXwmFiles = @((Get-ChildItem -Path "$($Root)" -File -Filter *.xwm -Recurse).FullName)

If ($arrXwmFiles.Length -gt 0) {
Write-Host "Starting conversion of files..."
ForEach($XwmFile in $arrXwmFiles) {
Convert-ToWav -XwmFile $XwmFile
}
} else {
Write-Warning "No files found?"
}
} else {
Write-Warning "$($Root) path not found?"
}
}

#
# convert all xmp files in folder 'in-place' to wav files.
# .xmp files get converted, serial wise a.k.a. synchronious, to .wav.
# the output wav file is placed next to the existing xmp file.
#
Convert-XwmBulk -Root ".\"
1 change: 1 addition & 0 deletions ffmpeg/put_ffmpeg_staticbuild_here.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://ffmpeg.zeranoe.com/builds/
2 changes: 2 additions & 0 deletions xWMAEncode/put_xWMAEncode_exe_here.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
https://www.nexusmods.com/skyrim/mods/32075/?tab=files

0 comments on commit f4d5c45

Please sign in to comment.