m35 / jpsxdec

jPSXdec: cross-platform PlayStation 1 audio and video converter
http://jpsxdec.blogspot.com/
461 stars 24 forks source link

Add ability to extract XA files raw without converting #18

Closed msikma closed 5 years ago

msikma commented 5 years ago

Environment

jPSXdec version: jpsxdec v0-99-8 rev3788 Operating system: Mac OS X 10.13.6 Java runtime environment: Java 10.0.2 (2018-07-17) - Java(TM) SE Runtime Environment 18.3

Description

I think it would be a nice addition if we could extract the XA files directly, rather than only being able to convert them to WAV/AIF/AU.

m35 commented 5 years ago

Understandable request, unfortunately it's not so simple as just extracting raw XA audio.

XA audio streams are very rarely on their own. They are almost always interleaved with other XA audio streams, or STR video. If you look closely at the start and end sectors of XA streams, you will find they overlap with other streams. So to extract one XA audio stream, you also have to extract all other interleaved streams.

Now if you you're ok extracting all the interleaved streams together, the extraction process is pretty straight-forward. XA "files" are actually just all the raw sectors pulled out of the disc into a new file. It's like a mini-disc with just the sectors for those interleaved streams.

There are a few ways you can extract those sectors of interest. If all those interleaved streams are found inside a File on the disc, you can use jPSXdec to extract that file. If not, you can use jPSXdec to find the range of sectors you need, and use a tool to extract that range. I think IsoBuster and CDMage can do that. If all else fails, jPSXdec also has a command-line option to copy a range of sectors out of the disc (search for copysect in the manual).

msikma commented 5 years ago

Thanks for explaining it 🙂

I'll see if I can work it out with the tips you gave.

My main reason for asking is because I wanted to add Tomba 2 JP to https://vgm.hcs64.com/. (It's different from the US/Europe versions.) But the truth is, I do believe that just the XA files themselves are far less useful than the exported WAV files provided by jPSXdec. They contain multiple songs per file and they're randomly ordered and don't have tagging, so maybe exporting XA files is really not a particularly useful feature.

m35 commented 5 years ago

I think this is good to close.