Extracting and Modifying Sound Files
Guides
/
Extracting and Modifying Sound Files
Updated 11 months ago by Jaka

As many of you know, recently the PoP speedrunning community has revealed their community DUB for SoT (PC) at PoPRuns6. Some of you are probably curious about how to replace some of the game's files yourself or maybe you are just curious about sound files that weren't used in the final game release. This guide will walk you through how to export and modify sound files. I will guide you through :

  • extracting .FAT/.BIG content
  • exporting .WAV files from .SB0 files
  • importing your .WAV files to .SB0
  • exporting your finished .BIG/.FAT file
  • general information and tips

Exporting .FAT/.BIG Content

First let's copy the .FAT/.BIG files from the Prince of Persia The Sands of Time/Sound directory to our temporary directory which I will name GUIDE.

https://i.postimg.cc/CK3n43KP/ZBKIkG4.png

https://i.postimg.cc/tTFZvBZX/0KdYMWg.png

Now let's download PoP_Sound_Repacker.exe which can be obtained via this link. We will place the PoP_Sound_Repacker.exe in the same folder and run it.

https://i.postimg.cc/C1pd8bv9/Gg0aNyU.png

Now we click Open .FAT and select our soundlocal.FAT file (this one features all voice lines). Then we will export the .SB0 files by clicking Extract sound files from .BIG.

https://i.postimg.cc/rs8mnM2J/eZmv6iK.png

https://i.postimg.cc/x8tdBh0S/MonfJhL.png

File Types

SB0 files

SB0 is Ubisoft's sound container file format which contains one or more WAV or LS0 files. Normally if it has a WAV file inside then that data is written inside the SB0 file itself, but if it features an LS0 file then this data is contained in stream.LS0 -* which is the largest of the exported files.

LS0 Files

LS0 is Ubisoft's sound file format which is a compressed WAV file. Normally it's used for longer voice lines or cutscenes to reduce the size of Sound folder. The problem is that our WAV files should be converted using "Ubisoft-4 bit ADPCM" but we have neither the codec nor the codec information.

WAV and LS0 Files Inside SB0

WAV files inside SB0 files will always have a name, for example PRIG283.WAV whereas LS0 files are always named STREAM.LS0. In terms of exporting/importing all we have to know that there's a difference between importing LS0 files and WAV files -* I will this explain later on.

Sound (SB) Repack Tab Information

Basic Commands

https://i.postimg.cc/jqXCWwyk/HebKstV.png

  • "Open" : Lets us pick an SB0 file to open.
  • "Reopen" : Re-opens the current file (useful for when you import your own sound files, to re-check if it is okay).
  • "Export" : Exports the currently selected file as .WAV file.
  • "Import" : Allows us to import a WAV file; the file is not yet changed upon import so we have to PATCH it.
  • "SB" : Patches an imported file to (and only to) WAV files from the list.
  • "Stream" : Patches an imported file to (and only to) LS0 files from the list.

Anything marked as red is not explained here because it's either useless or too "advanced".

Listening to SB0 Files

Let's open the largest SB0 file voingstm.SB0. This file includes 193 WAV/LS0 files. Select one of the files on the list and click on the "Play" button. The file should play.

Exporting WAV Files From SB0 Files

Select a file from the list and click on "Export" to save it somewhere. The exported file will be a WAV file.

Creating Your Own WAV Files

As useless as this section may appear at first, it actually is very important. Let's check the following three images:

https://i.postimg.cc/YqC0Qr32/GY73dcF.png

https://i.postimg.cc/65b30kjr/P1J7Q9c.png

https://i.postimg.cc/nhsLw3g6/2CgWSjU.png

These are 3 different files because of different "Sample rate" and "Channels" properties. You have to make sure that your WAV file is using the exact same configuration. The easiest way we found is to export the original sound file and load it into Audacity, because Audacity will automatically select the same configuration as the imported file. There are multiple upsides to this method:

  • First, like I mentioned, we already have correct settings for recording
  • Second, we know the length of the playback. This matters because if the playback is too long and game plays another sound file right after that, it will cut the previous one short, hence why you should, in general, make sure that the playback length is the same as (or less than) the file that you plan on changing.

Difference Between Importing SB0 and LS0

There is actually a slight difference between importing SB0 and LS0 files: As I mentioned before, LS0 files are compressed WAV files, but we don't have access to Ubisoft's codec. You could technically import LS0 files just like SB0 files, but certain frequencies of voice lines make the file sound very noisy (as in, white noise); in additions to some other, smaller differences. Also the overall sound quality isn't good. That's why we conducted some research and so far the best solution we found is to use ffmpeg: link

If you plan on changing an LS0 file, first do the following for your WAV file (let's call it A.WAV for convenience). Once A.WAV and ffmpeg.exe are in same directory, open the console (e.g., by typing "cmd" into the address bar and hitting Enter, assuming you're on windows) and execute the following commands:

  • ./ffmpeg.exe -i A.WAV -c:a adpcm_ima_apm B.apm
  • ./ffmpeg.exe -i B.apm -bitexact -c:a pcm_s16le C.WAV

Now if you import C.WAV and patch it to stream (LS0) the audio itself should sound okay, with the exception of a "click" sound at the end of the file which we have yet to find a fix for.

The Spreadsheet: The Heart of It All

Unlike us (me & Toca), you won't have to face the tedious task of opening each file one-by-one and checking its content (which totally didn't take us a couple of days). All you have to do is open the spreadsheet we created (click here). There you can search through all the files that are inside soundlocal.FAT (tab "english") and sound.FAT (tab "local"). Note that the spreadsheet is protected so if you want to edit anything you'll have to create a copy in your drive (File > Make a Copy).

You can also sort by Chronology, File, Content, Characters and Text:

https://i.postimg.cc/HLXkTVpz/mifRjPQ.png

How to Use the Spreadsheet

Let's say we want to change the very first line in the game (Do you think I felt regret as I gazed...):

  • Locate this line in the spreadsheet using "CTRL + F". While there are two similar voice lines here. if you listen through the first lines you'll quickly hear that the second one is the one we want. The ID corresponding to the file is 706 (the ID is found in column A).

https://i.imgur.com/QWbdjji.png

  • Next we open the voingstm.SB0 file (as written in column B​) as that's the file which this voice line is located in.
  • Since this is an LS0 file we have the problem that, once we opened voingstm.SB0, we don't know which STREAM.LS0 file corresponds to ours. Luckily if you sort the column Chronology (column A) "from A to Z" we will know exactly where it is by using {named}.WAV files as offset.
  • "CTRL + F" and search for 706; we then learn that PRIG283.WAV is exactly 15 files away from the file we're interested in.

https://i.postimg.cc/ZRLYy2vy/XnEUVeY.png

  • This lets us locate (33) STREAM.LS0 which is the file we are looking for; indeed, 15 files above it is the file PRIG283.WAV.
  • Now we just have to import our WAV file using "Import" and clicking on the appropriate patch button; in this case it's "Stream" (note that if you clicked "SB" you'd get an error sound letting you know that you picked wrong one; and vice versa for a WAV import).
  • Let's click on "Reopen" and play our file again to ensure that the import went well. The above file isn't the easiest to find which is why I wanted to include it as an example. In most other SB0 files you'll find at most ~5 files of which are all of the form {NAME}.WAV; here {NAME} can be used as an ID when searching using spreadsheet.

Exporting Our Modified .FAT/.BIG

All we have to do is make sure that in the Fat/Big Repack tab we have loaded the .FAT information.

The first picture shows an empty list and the second picture shows the loaded .FAT information. To answer which .FAT we open: If we changed soundlocal.FAT, then we open that one. Now all we have to do is click on "Repack .BIG" and "Save .FAT".

https://i.postimg.cc/C1pd8bv9/Gg0aNyU.png

https://i.postimg.cc/x8tdBh0S/MonfJhL.png

Tips & Tricks

Tip on How to Voice Over Cutscenes

Sooner or later you'll probably wonder how to re-dub cutscenes, given that there is no cutscene "base file" (i.e. without the original voices). There is actually a neat trick we can use: First import original the cutscene audio to Audacity and then follow the pictures below:

https://i.postimg.cc/SRNSLdc1/l8OGx8T.png

https://i.postimg.cc/VvGYKtRf/BuOGMs5.png

The reason this works is because the original voice lines are recorded in mono, and once we split stereo into two mono channels both of them contain same voice line "waves". Hence if we invert one track that features exact same mono track as the other one they'll cancel each other out. Now we have cutscene sound without the voice lines in acceptable quality.

If you want your edited files to sound closer to the originals you'll probably switch from the original to the inverted file whenever a voice would play (and smoothen things with the fade in & fade out commands), and switch back after the voice part. Like this, the original sounds (e.g., fighting) will not sound altered, and the switch to your voice recording wlil be barely noticeable.

Toca also made a video (link) about it.

General Tips

  • You don't have to always export SB0/LS0 files upon starting PoP_Sound_Repacker.exe. You can change one WAV file and close and reopen PoP_Sound_Repacker.exe. However, before you create the .FAT/.BIG file you'll have to read the appropriate .FAT file and then click "Repack .BIG" and "Save .FAT".
  • If you by accident wrote an WAV file to LS0 without using the same configuration (e.g., different "Sample rate") don't worry! Reconfigure your original WAV file and re-import to fix it.
  • If you select a .WAV file from the list and click "Play ADPCM" you will experience serious ear rape (try it if you don't trust me); same if you select .LS0 and click "Play PCM".

Shoutouts

The above guide wouldn't have been possible without R4nger as he provided the majority of above information. Also importing/exporting sound files wouldn't be possible without DedGameOver's (DGO) sound repacker.

Game stats
Followers
210
Runs
422
Players
49
Latest threads
Posted 2 years ago
0 replies
Posted 2 years ago
5 replies
Posted 5 years ago
0 replies
Posted 3 years ago
4 replies
Moderators