News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: [PS2][Tutorial] Sound MOD tutorial  (Read 595 times)

0 Members and 1 Guest are viewing this topic.

Offline Charor

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
[PS2][Tutorial] Sound MOD tutorial
« on: January 30, 2024, 11:33:39 PM »
This is a sound mod tutorial for PS2 version of Bully video game

-------------------------------
LONG STORY SHORT
-------------------------------
  • download PS2 sound kit.zip and extract it
  • Make sure .lst file is there with .bin (from ISO \AUDIO\PLAYLIST\)
  • Drag and Drop .bin file on export wav.bat
  • Edit wavs you want and delete unmodified wavs
    Modded audio must be same duration or shorter, same sample rate and channels as originals
  • Save as wav s16 pcm. Don't change names
  • Drag and Drop .bin file on import.bat
  • Replace original .bin with moded .bin in ISO
  • Done!

FOR THOSE WHO WANT TO DIVE DEEPER

------------------------------------
GENERAL INFORMATION
------------------------------------

audio\PLAYLIST\ folder contains some .bin files:
Sound for cutscenes and dialogs resides in Cuts.bin and Speech.bin files
Music is in Music.bin
Ambient sound, like birds, crowd noise, dogs, music class intro, preacher prayers etc are in Ambs.bin

Aside there is a .LST files with same name as .bins (Cuts.lst Music.lst etc)
Its a name list files. We will need them later
You can open them with notepad if you need to

.bin sound file contains .rsm (idstring RSTM) files
According to vgmstream Is a Rockstar Games RSTM
Compressed as Playstation 4-bit ADPCM


For all chimichanga we will need some tools:
  • quickbms - universal script based files extractor and reimporter
  • MFAudio - a tool allows you to play, convert, and downsample audio files that use some of the more common formats among PS2 games
------------------------------------------------
EXTRACT SOUND FOR MODDING
------------------------------------------------
to extract PS2 bins use PS2bin2ss2.bms
Make sure .lst file is there with .bin
Code: [Select]
// Bully Scholarship Edition PS2 ss2 extrctor
// Extract ss2 file or files from bin using this script
// use quickbms PS2bin2ss2.bms <<Dir>>.bin to extract ss2 files
open FDDE bin 0
open FDDE lst 1

get Dir BASENAME
idstring "Hash"
get FILES long
log MEMORY_FILE 0 0
log MEMORY_FILE2 0 0

for i = 0 < FILES
//file data
   get FILEHASH long
   get OFFSET long
   get DataSIZE long
//read filename from lst file
get NAME line 1
string NAME - 4
string NAME P "%DIR%/%NAME%.ss2"

//rstm header
log MEMORY_FILE OFFSET 0x800

math OFFSET + 0x800
math DATASIZE - 0x800

//PS ADPCM data
log MEMORY_FILE2 OFFSET DataSIZE

//audio settings from header
set Format long 0x10 // 0x01 PCM 0x10 4bit PS ADPCM (OKI ADPCM?)
set BitsPerSample long 16
GetVarChr SampleRate MEMORY_FILE 0x08 long
GetVarChr nChannels MEMORY_FILE 0xC long

//create ss2 header instead of rstm for MFAudio
set MEMORY_FILE binary "\x53\x53\x68\x64\x18\x00\x00\x00\x10\x00\x00\x00\x22\x56\x00\x00\x02\x00\x00\x00\x10\x00\x00\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x53\x53\x62\x64\xC0\xB9\x17\x00"
putvarchr MEMORY_FILE 0x08 Format long
putvarchr MEMORY_FILE 0x0C SampleRate long
putvarchr MEMORY_FILE 0x10 nChannels long
putvarchr MEMORY_FILE 0x14 BitsPerSample long
putvarchr MEMORY_FILE 0x24 DataSIZE long

   append
   log MEMORY_FILE 0 DATASIZE MEMORY_FILE2
   append
   get DATASIZE asize MEMORY_FILE
   log NAME 0 DATASIZE MEMORY_FILE

next i

As a result, we will get folder named as .bin name with .ss2 files in it
(script create ss2 header instead of rstm for correct MFAudio work)

.ss2 need to be decoded:
as i know, MFAudio can decode/encode .ss2
Code: [Select]
MFAudio.exe /II10 /OTWAVU "Speech\Algie_CHATTER_v2.ss2" "Speech\Algie_CHATTER_v2.wav"

Now you can edit this wavs in any audio editor you like
Modded audio must be same duration or shorter same sample rate and channels as original
Save as wav s16 pcm

--------------------------------------
COMPRESS SOUND BACK
--------------------------------------
use MFAudio again:
Code: [Select]
MFAudio.exe /OTRAWC "Speech\Algie_CHATTER_v2.wav" "import\Algie_CHATTER_v2.datAs a result we got our moded wavs PSADPCM encoded in import\ folder ready to be imported in .bin

----------------------------------------------------
IMPORTING MODDED SOUND BACK
----------------------------------------------------
Use PS2bin2dat.bms script with r and w options
Code: [Select]
quickbms -r -w PS2bin2dat.bms Speech.bin
Code: [Select]
// Bully Scholarship Edition PS2 sound dat extractor
// Extract dat file or files from bin using this script
// use quickbms PS2bin2dat.bms <<Dir>>.bin to extract dat files
// Mainly used for importing sound back to .bin
// Usage: quickbms -r -w PS2bin2dat.bms <<Dir>>.bin

open FDDE bin 0
open FDDE lst 1

get Dir BASENAME
idstring "Hash"
get FILES long

for i = 0 < FILES
//file data
   get FILEHASH long
   get OFFSET long
   get DataSIZE long
   
   math OFFSET + 0x800
   math DataSIZE - 0x7E0 // 0x800 - 0x20 fix for MFAudio raw import (+0x20 footer)
//read filename from lst file
get NAME line 1
string NAME - 4
string NAME P "import/%NAME%.dat"

log NAME OFFSET DataSIZE

next i
to import back sound dat file(s) from import folder to .bin (Speech.bin in example above)
.dat files must be named same as in .LST (i.e. Gordon_CONVC_v2.dat Isaacs_3-S01d_D5_PASS_v1.dat Handy_CFH_v2.dat)
.LST file must be near .bin file

Now you need to replace original .bin inside ISO with modded and test in game!

Easiest way to do that is open ISO in hex editor and rewrite file at its offset (LBA*2048)
i.e. for Cuts.bin LBA is 682568 offset 682568*2048=1397899264

Not sure is it correct way to replace file in PS2 iso. Maybe it will brake some crc or copyright protections.
Better use special PS2 tools for that.

Anyway, this method works on emulator for test purposes

UPD: tutorial updated - solved batch encode/decode with MFAudio
« Last Edit: January 31, 2024, 10:38:56 PM by Charor »

Offline Charor

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: [PS2][Tutorial] Sound MOD tutorial
« Reply #1 on: January 31, 2024, 12:36:49 AM »
Here is a proof of concept
First two cutscenes with russian voice over

its xdelta patch for USA iso (SLUS_212.69)

Unzip
Run DeltaPatcher.exe
Choose "Original file" your iso
Choose xDelta patch "Bully (USA).xdelta"
In settings ⚙ check "backup original file"
Press "Apply patch"
Wait for patched iso