How do I convert XAS (not XA) sound files from a PSX game to WAV files?

Started by Animedude5555, February 09, 2015, 12:29:43 AM

Previous topic - Next topic

Animedude5555

All the PSX sound players and converters available on the net are only for XA sound files, not XAS sound files. However, the game "Shiritsu Justice Gakuen" (the Japanese version of the game School Rumble) and also possibly the US version of the game (though I've not had a chance to play that game yet) has these XAS files. Not sure if these are proprietary Capcom files (or even ones just specific to this game), or if they are an alternate form of XA sound files, that just has never been supported by PSX sound players and converters. Whatever the case, I have never seen any internet discussion about XAS file ripping, and only references to XA sound files when the topic has been about PSX sound files. If somebody here knows anything about the XAS sound format, and what software is needed to play/convert it, please let me know.

Bregalad

There is only 2 formats sound on the playstation can be played : XA and native (sometimes reffered to as VAG), which is some kind of evolution of the SNES' BRR.

I doubt any game use a format other than these 2, if they do they'd have to re-encode using VAG by software because the playstation can't even play uncompressed sounds natively.
In any case if it's not XA then it should be "VAG", but if the file is called "XAS" then I think it's simply another name for "XA" and that the sound is actuallly XA.

The best way is to play it in an emulator that supports the sound debugging and see.

Dashman

Maybe those XAS files are just XA files packed together into a single file? Take a look at the beginning of the file to see if there's anything resembling a pointer table. There could also be another file giving the offsets for the tracks inside the files if this was the case.

Animedude5555

Quote from: Bregalad on February 09, 2015, 03:17:34 AM
There is only 2 formats sound on the playstation can be played : XA and native (sometimes reffered to as VAG), which is some kind of evolution of the SNES' BRR.

I doubt any game use a format other than these 2, if they do they'd have to re-encode using VAG by software because the playstation can't even play uncompressed sounds natively.
In any case if it's not XA then it should be "VAG", but if the file is called "XAS" then I think it's simply another name for "XA" and that the sound is actuallly XA.

The best way is to play it in an emulator that supports the sound debugging and see.

I was thinking that maybe it was a proprietary format that gets decoded in memory when the game is loaded in memory, and that the decoded version is then sent to the Playstation's sound chip. I was wondering if maybe XAS stood for XA Secured (secured as in copyprotected, by the use of a proprietary file format).

Whatever the case. I can't use them in any PSX sound player or converter. In fact I couldn't properly copy them off the CD-ROM image (bin/cue pair) by using the normal Windows file copy functionality. I had to use a program called ISO Buster to get it off the disk image. My procedure was as follows:
Put the disk image's CUE file into the free Alcohol 52% virtual CD drive. It automatically uses this to correctly load the BIN file (the actual disk image).
Run ISO Buster and select the virtual CD drive.
I then extracted each XAS audio file using each of the following methods:
Extract RAW Data (extracts the content of the file including the physical structure of the disk such as sector headers)
Extract Raw but convert to User Data (extracts the content of the file, but does not include any physical structure of the disk)
Extract [FILENAME] (similar to the above method, but generates errors on some sectors, and does not extract sectors that have errors)

[FILENAME] is a placeholder where in the actual program the name of the file to be extracted appears at this point in the menu option.

I have uploaded to Mediafire a Zip file containing 3 copies of the file COMN05.XAS (each extracted with a different method as mentioned above), for other hackers on this site to examine, and tell me what they think this type of file is. Here is the download link.
https://www.mediafire.com/?an539fjlzbou1i5

Bregalad

QuoteI was thinking that maybe it was a proprietary format that gets decoded in memory when the game is loaded in memory, and that the decoded version is then sent to the Playstation's sound chip.
This is impossible : The Playstation can't play uncompressed sound at all, so after decoding the proprietary format, the game would have to re-encode in VAG format, which is a complicated and lossy operation, that would take much of the playstation's CPU processing power, so it'd be an awful technical choice.

For that reason I'm pretty positive no game use other codecs than the ones natively supported by the Playstation sound chip.

QuoteIn fact I couldn't properly copy them off the CD-ROM image (bin/cue pair) by using the normal Windows file copy functionality.
This is absolutely normal and has nothing to do with security, as XA uses error correction data as actual data instead, so windows think the file is corrupted and displays an error. Only dedicated tools that call low level functions to access the CD-ROM (rather than the normal file handling functions) can correctly rip Playstation XA audio/video files.

Have you tried to use PSound ? Or PSMPlay ?

This also "proves" that the file is using XA audio, as if it was using anything else, the error correction would have to work normally, and you could open the file with Windows.

Also, while we are at it, the Playstation do not care at all what is the name of the files on the CD. If the game was programmed to play sound starting from sector #x, and if the sectors contains valid sound data, then it will just play them happily, ignoring completely whether the corresponding file is called "XA", "XAS", "STR", or anything else.

I am not totally sure about this but a developer who wanted to be evil enough could even split the data in multiple files and/or merge it with unrelated files, the Playstation would ignore it entierely when playing streamed audio/video. I might be wrong on that last point, though.

Gemini

CAPCOM games usually append that S when files are actually packages. These formats don't use any headers as the executable or an overlay would provide addressing methods and data. In other words XAS is made of a bunch of XA files merged to be one thick block.
I am the lord, you all know my name, now. I got it all: cash, money, and fame.

Animedude5555

Quote from: Gemini on February 09, 2015, 08:41:55 PM
CAPCOM games usually append that S when files are actually packages. These formats don't use any headers as the executable or an overlay would provide addressing methods and data. In other words XAS is made of a bunch of XA files merged to be one thick block.

Wow. Thanks. That's a big important piece of info! Now I just need to know how to separate out the sounds. If it has no header, and is hardcoded into the game. I'm going to need to basically run a disassembler on the game's executable. However I have no skills in this area, so I hope somebody else here knows how to do that. If anybody knows how, I can provide the file that I believe is the executable program, to be analyzed.

Gemini

You don't need to do the whole process, just the relevant bits where the game enters XA mode with the cd unit. Usually this is done by calling CdRead2 or DsRead2 with mode parameter set to DslModeStream | DslModeSpeed | DslModeRT (encoded as 0x100 | 0x80 | 0x40 in terms of numbers). Somewhere close to that you get a seek call with the logic address encoded as MSF (minute/second/frame). Find how it generates the address and you get your depack data.
I am the lord, you all know my name, now. I got it all: cash, money, and fame.