- Bio 0 "sound" folder discoveries (and a sample extractor) by Nisto at 11:55 PM EDT on April 27, 2014
- Hi all. I made some discoveries about the "sound" folder from Bio0 (Resident Evil 0). I don't know if any of this was already known, but I hope it will be helpful to some anyway. The "demo" folder, which seems to have some more samples, is still a big unknown to me, so the script I wrote will not work on any other files from the game. Although, the files in that folder appears to have essentially the same layout of audio data as in the "sound" directory - only they seem to be compressed/encrypted. So I hope we can figure out how to decompress/decrypt those one day.
.arc = these can contain just about anything, but for the "sound" directory, all of them contain only "pool", "proj" and "sdir" files, respectively
.sam = samples
.son = sequencer data.. I think
If you're curious, you can extract the internal files from the .arc files with MarkGrass' excellent tool, BioFAT (SVN6 anyway).
The sdir files contain DSP header data (such as sample rate and coefficients) and some other data. They contain two tables, which are terminated by 0xFFFFFFFF. As for the pool and proj files, I can't figure those out. If someone knows though, enlighten me/us!
Table 1 (each entry is 32 bytes)
16 No idea.
16 Reserved? This is always 0x0000.
u32 Sample's offset in the .sam file.
32 Reserved? This is always 0x00000000.
16 No idea. This is always 0x3C00.
u16 Sample rate.
u32 Total number of RAW samples.
u32 Loop start offset?
u32 Loop end offset?
u32 Pointer to entry for this sample in the next table.
Table 2 (each entry is 40 bytes)
u16 Size of the first chunk of the entry. This is always 0x0008.
48 Not sure what's stored here.
The sample extraction script can be downloaded here.
It's written in PHP (I know, it's a dumb language to use for a task like this, but it's so easy to use), so you'll need PHP. I'm sorry if it's any trouble. Getting the script running is not a lengthy process, even if you're unfamiliar with PHP. Simply get the binary package (windows.php.net for Windows users), unpack it anywhere, then, in a command prompt/terminal use the CD command to change the current working directory to the directory in which you extracted the binaries.
To actually run the script:
php [path...]script_name.php [path...]bio0_sound_dir
php C:\SamExtract.php C:\bio0\sound
If you come across a bug, please do notify me! I honestly wasn't sure if I should share the script in the first place, due to the harsh criticism it may or may not receive. This is the first time I share the full source code of a project, so please go easy on me.
Finally, some important things to note...
1: The first six samples of voice_1.sam contain only null bytes, and very few of them. As a result, your player (foobar2000 in my case) may crash if you try to open them, so please avoid these samples if possible!
2: The script won't add any loop values to the header [yet] as I'm not sure if those are standard loop start/end offsets in the sdir table (or if they're even loop values at all). Mainly because some of them don't make sense to me, like here for example -- the start offset (assuming that's what it is) is higher than the end offset(?) in a lot of cases. I also don't think they're offset+length pairs. So, if anyone figures it out, certainly do let me know, or post an update of the script even.
- by Benjamin at 3:22 AM EDT on April 28, 2014
- Does it also work with .samp files such as Paper Mario: The Thousand-Year Door's?
- by Nisto at 12:33 PM EDT on April 28, 2014
- I don't know what those files looks like. Although, if they're only .samp files without any complementary files (like .arc in the case of Bio0), then I don't think I can help you. Can you upload one of them?
edited 12:39 PM EDT April 28, 2014
- by Benjamin at 3:03 PM EDT on April 28, 2014
- No, it doesn't have an .arc file. It has:
Also, there was an earlier topic with the files as well.
- by Nisto at 4:48 PM EDT on April 28, 2014
- Ah okay, cool. Can you upload some examples? I'm having trouble finding that thread. Maybe I can modify the script to work with both.
edited 4:54 PM EDT April 28, 2014
- by Benjamin at 5:17 PM EDT on April 28, 2014
- Well, I forgot that the file was deleted, but I can give you the files, I think: https://www.dropbox.com/s/053wd3plwz2iwwo/proj.zip
- by Nisto at 7:26 PM EDT on April 28, 2014
- Easy-peasy. This will extract the Mario samples as well: SampExtract.php
Use it just as described in the OP, only, supply the path to the directory with the Mario sdir/samp files instead, obviously.
The other files seems to contain names for each FX or something.. You'll have to figure that out yourself. But I hope simple numbered filenames will do.
Also, I noticed that some of these files, vgmstream simply will not play. You can likely use DSPADPCM (from the Wii/NGC SDK) to properly convert those to WAV though.. if you don't mind not preserving the format.
edited 7:51 PM EDT April 28, 2014
- by Benjamin at 8:06 PM EDT on April 28, 2014
- Thanks! I've been looking for a way forever.
Anyway, yeah, those will do until loops are discovered. But with Super Paper Mario already rippable with BrawlBox that MIGHT help, because it ports some sounds from PM:TTYD.
EDIT: I think I found where the loop offsets would be. 2 offsets after the number of samples, I think.
edited 8:43 PM EDT April 28, 2014
- by Nisto at 8:48 PM EDT on April 28, 2014
- EDIT: I think I found where the loop offsets would be. 2 offsets after the sample rate, I think.
You mean the value (4 bytes) to the left of the first value marked green in the picture I linked in the OP?
What makes you think the offsets are there? It begs the question of what the value right after the number of raw samples is.
edited 9:04 PM EDT April 28, 2014
- by Benjamin at 9:16 PM EDT on April 28, 2014
- Well, a while ago, I ripped some sound effects from SPM with BrawlBox. I discovered the loop because the sample for the sound where Mario is blasting off (or when an item is being thrown by the audience) has the same loop as a similar sound in SPM, and found the loop there. That loop was 7588, I converted it to hexadecimal, and discovered the loop offset.
EDIT: The offset right after the sample offset, I don't know, but it could be for if the loop points are longer than FF FF in hexadecimal (?), but I don't know of any samples whose loops would last longer than that.
edited 9:17 PM EDT April 28, 2014
HCS Forum Index
Go to Page 0 1 2 3 4
Search this thread
Show all threads
Reply to this thread:
Halley's Comet Software
Generated in 0.0039s;