News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: [PSX] Exchange CDDA tracks in PSOne games  (Read 1696 times)

TuF

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
[PSX] Exchange CDDA tracks in PSOne games
« on: November 22, 2017, 07:56:20 am »
Hi,

I'm new here and firstly I'd like to thank this board for existing since I downloaded a lot of ROM-hack IPS files for years. This is an awesome place and after hours of unsuccessfully searching the internet for my (hopefully upcoming) project, I decided to put my request here. I'm very new to rom hacking itself but I'm willing to work myself into the needed topics :)

Nowadays almost anything is possible regarding rom hacking and after listening to awesome game music covers on YouTube I asked myself if it is possible to replace some rubbish music of some games with more energetic ones. I'm specifically talking about Mega Man X3 which had a good OST on the SNES, but a shitty one on the PSX/Saturn versions. I understand that there are different types of music usage in different games like using XA or CDDA streams like in Tomb Raider, Mega Man, etc.

Sadly I cannot find any methods of how to exchange music data specifically and what has to be considered during the process. Do you guys know a good tutorial where I can work into? Or do you have hints which might help me? Maybe I was just using the wrong keywords :D

Thank you and have a nice day!

Best,
TuF



Post Scriptum: I hope my English isn't that bad and you guys will understand what I'm trying to say :D
« Last Edit: November 22, 2017, 04:54:07 pm by TuF »

Jorpho

  • Hero Member
  • *****
  • Posts: 3858
  • The cat screams with the voice of a man.
    • View Profile
Re: [PSX] Exchange CDDA tracks in PSOne games
« Reply #1 on: November 23, 2017, 12:40:34 am »
I remember a list of PSX games that use CDDA over here.  There aren't very many of them:
https://forum.digitpress.com/forum/archive/index.php/t-11378.html

There are a bunch of PSX audio utilities over here, though many of them might be out of date.  Perhaps that will get you started:
https://www.zophar.net/utilities/psxutil.html
This depresses me. I feel like a goldfish right now...

TuF

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: [PSX] Exchange CDDA tracks in PSOne games
« Reply #2 on: November 23, 2017, 03:55:01 am »
Thank you :)
As far as i understand, Mega Man X3 uses Redbook audio files which means that I can listen to then in my CD player. I've already found the list of tools via Zophar.net. Is there anywhere a kind of tutorial how to exchange the tracks / what has to be done additionally?

Thanks for your help.

Best,
TuF


EDIT:
Maybe I've found a good start with this thread: https://www.doomworld.com/forum/topic/32729-editing-psx-doom/
It says:

"MODDING: Music

There's not really much you can do here for now, but you can replace the Redbook Audio among the things you could do. For example, let's go into this directory: /PSXDOOM/CDAUDIO/
You'll see that everything is a bunch of .RAW files... RAW Wave data! That would also explain the big filesizes that are not common in MP3's or OGG's and certainly not MOD's. Anyway, get something like winLAME and some of your favorite music and convert the music you want into WAV's with their 16-bit headers STRIPPED. The output should be a .RAW file! Then, just name it correctly and you have yourself some Redbook Audio!"
« Last Edit: November 23, 2017, 04:02:02 am by TuF »

Jorpho

  • Hero Member
  • *****
  • Posts: 3858
  • The cat screams with the voice of a man.
    • View Profile
Re: [PSX] Exchange CDDA tracks in PSOne games
« Reply #3 on: November 23, 2017, 10:21:22 pm »
As far as i understand, Mega Man X3 uses Redbook audio files which means that I can listen to then in my CD player.
I can see there are threads like https://www.letsplayindex.com/videos/2984570-mega-man-x3-review-quickies-dont-cut-it-retropolis-zone and http://www.psx-place.com/threads/i-finally-got-music-to-work-with-mega-man-x3.10389/ which refer to "redbook audio", but I think they're only using the term in the sense of stereo, 16-bit, 44100 kHz sound and not necessarily to how the sound is actually stored on the disc.

That thread about DOOM that you linked to talks about a directory named "cdaudio" containing raw wave data, but I think that's just a coincidence.  If the disc has different sound that is playable on a CD player (as suggested by the thread I linked to), then that sound is stored separately from the rest of the filesystem (and can be easily replaced).

But I'm kind of speculating here and I fear I am only causing confusion.  Perhaps someone who actually has the disc on hand can actually chime in.  (But I might add even though DOOM apparently stores files in a convenient format, PSX games don't necessarily have to use the standard ISO9660 filesystem at all.)
« Last Edit: November 23, 2017, 10:39:51 pm by Jorpho »
This depresses me. I feel like a goldfish right now...

TuF

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: [PSX] Exchange CDDA tracks in PSOne games
« Reply #4 on: November 24, 2017, 06:12:07 am »
Quote from: Jorpho
which refer to "redbook audio", but I think they're only using the term in the sense of stereo, 16-bit, 44100 kHz sound and not necessarily to how the sound is actually stored on the disc.

Ah ok, I thought that this is referring to CDDA tracks generally. I have the original PAL disc right here und I've put it onto my DVD drive. It shows me that:


Within the ST0 folder there are the biggest files in size, but I've learned that these are the movie clips:


My next step was it to create an .ISO file, but I ended up with .MDF/.MDS because DAEMON Tools told me that it would be impossible to create an .ISO for multisession discs. I went over to Alcohol 120%, used the option for "PlayStation" games creating the image file(s). By using UltraISO I was finally able to see the music tracks. Because CDDA music based PSX games are Mixed Mode CDs, I had to find the option to show them. Now I have this:


Now, I've found a statement in the PSX-scene forum:
Quote from: Berion
Also, I don't recommend UltraISO for manipulate PSX images (and any consoles disc images) because it not preserve original LBA. In some cases this is very important because some games checking LBA of his files or seeking files by LBA not using TOC.
Do you think the same way?


Best regards,
TuF
« Last Edit: November 24, 2017, 07:52:30 am by TuF »

Jorpho

  • Hero Member
  • *****
  • Posts: 3858
  • The cat screams with the voice of a man.
    • View Profile
Re: [PSX] Exchange CDDA tracks in PSOne games
« Reply #5 on: November 24, 2017, 09:33:40 am »
All right, forget what I said – I guess it does use proper redbook audio tracks.  (That makes it a rather glaring omission from the thread I linked to.)

So, that makes things simple, in theory.  You just need a program that will rip a mixed-mode CD to ISO+WAV+CUE.  A little bit of Googling suggests TurboRIP.  (Yes, it was originally for TurboGrafix games, but it looks like it should work here.)
http://www.theisozone.com/downloads/pc/other/turborip-v140/

After you replace the .WAV files with whatever you want, you'll need to fix the .CUE file.  In case you don't already know, a .CUE file is an ordinary text file that you can open with Notepad, and it specifies the layout of the tracks on the disc – meaning you'll need to change it if you're replacing the old .WAV files with new ones that have a different length.  It looks like you can use CUE Sheet Generator to automatically generate a new .CUE file.
https://sourceforge.net/projects/cuegen/

After that, you should be able to open the .CUE file with Daemon Tools or any decent disc-burning program.  This might work, although it's quite possible that it's not that simple.
This depresses me. I feel like a goldfish right now...

TuF

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: [PSX] Exchange CDDA tracks in PSOne games
« Reply #6 on: November 25, 2017, 03:53:45 pm »
Wow! Thank you very much. :)
So, I created a rip using TurboRIP and it gave me this (I had to give this game a name due to the lack of an entry in the database):


In this screenshot, you'll also see the .CUE sheet which I've opened using WordPad. Is it a must to rename the tracks into Track X.wav again? Or is it only necessary that the .CUE sheet adresses the tracks correctly?

One thing makes me curious. I've found a thread in the PSXdev forum. In the following post LameGuy64 had a different mode typed down as you can see here in this quote:
Quote from: LameGuy64
Try doing this:
1. Rip the disc as a bin/cue image using Imgburn with all tracks stored in separate files.
2. Convert your custom tracks into 16-bit stereo wav files with no track information.
3. Name the wav files as Track 02.wav, Track 03.wav, and so forth.
3. Add 2 seconds of nothing into all of the wav files except the first one.
4. Open the cue sheet file with Notepad and rewrite the contents into this:

Quote
CODE: SELECT ALL
FILE "Tomb Raider.bin" BINARY
  TRACK 01 MODE2/2352
    INDEX 01 00:00:00
FILE "Track 02.wav" WAVE
  TRACK 02 AUDIO
    PREGAP 00:02:00
    INDEX 01 00:00:00
FILE "Track 03.wav" WAVE
  TRACK 03 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "Track 04.wav" WAVE
  TRACK 04 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
(...and so forth)


5. Open the cue sheet using ImgBurn and burn it into a rewritable CD.
6. Test the tracks using Windows Media Player or any media player that can play CD audio tracks.
7. If the tracks play correctly, rip the disc using ImgBurn again but with all tracks stored in a single bin file.
8. Test the image on an emulator.

If the tracks won't play properly in the game, try writing the cue sheet like this:

Quote
CODE: SELECT ALL
FILE "Tomb Raider.bin" BINARY
  TRACK 01 MODE2/2352
    INDEX 01 00:00:00
FILE "Track 02.wav" WAVE
  TRACK 02 AUDIO
    INDEX 01 00:00:00
FILE "Track 03.wav" WAVE
  TRACK 03 AUDIO
    INDEX 01 00:02:00
FILE "Track 04.wav" WAVE
  TRACK 04 AUDIO
    INDEX 01 00:02:00
(...and so forth)


If you can't handle dealing with all this trouble, link me to the remastered audio package you've mentioned and I'll try to reconstruct the disc image myself for you.
...while mine says CDI/2328. Furthermore LameGuy64 wrote two options. In the first one he put in 2s of space (INDEX 0). In my .CUE sheet there is no INDEX 0. So INDEX 1 tells the game when to start the actual track, right?

Best,
TuF
« Last Edit: November 25, 2017, 04:12:14 pm by TuF »

weissvulf

  • Sr. Member
  • ****
  • Posts: 324
  • Good news! An anomaly solved the enigma.
    • View Profile
Re: [PSX] Exchange CDDA tracks in PSOne games
« Reply #7 on: November 26, 2017, 01:30:52 am »
The Redump project maintains accurate dump info for most PS1 games and you can get a cue sheet there. The Euro MegaMan X3 is HERE. The CUE simply lists the order the tracks are 'stacked' in so LBA etc is adjusted automatically.
« Last Edit: November 26, 2017, 01:41:46 am by weissvulf »

TuF

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: [PSX] Exchange CDDA tracks in PSOne games
« Reply #8 on: November 26, 2017, 10:44:18 am »
Alright, I just downloaded the .CUE sheet you've linked. Furthermore I've found the project I'm going to work on already finished called "Mega Man X3 - Rock Version (real guitar covers)": My goal was it to implement the metal cover soundtrack made by Krzysztof Słowikowski. Nevertheless I've downloaded this already finished version in PAL version and NTSC/J (Rockman X3) because both are available and NTSC is in 60Hz. Then I've downloaded a version called "Mega Man X3 - PSX Version [Fixed]".

I've compared the .CUE sheet from The Redump project with the other two. All of them are different. So I as myself if this makes any specific difference and if yes - which ones?

From LEFT to RIGHT: Redump Project / X3 (Fixed) / X3 (NTSC/J, including the rock covers)

Even if the project is already made by someone (I haven't thought of that possibility to be honest) I don't want to give up on it because I want to learn how these things work so I might be able to recreate this while understanding it also. I also want to have this feelings of accomplishment and want to work on further projects :D

I hope, you're still helping me on my way, @Jorpho and @weissvulf

Best,
TuF
« Last Edit: November 26, 2017, 03:15:47 pm by danke »

Jorpho

  • Hero Member
  • *****
  • Posts: 3858
  • The cat screams with the voice of a man.
    • View Profile
Re: [PSX] Exchange CDDA tracks in PSOne games
« Reply #9 on: November 27, 2017, 12:28:24 am »
Why don't you just start burning things (or opening them in your emulator or Daemon Tools) and seeing what works..?

I've never seen a CUE sheet like the one shown for the Redump Project, nor do I have any idea why someone would do things that way.  The Redump Project probably has a FAQ on the subject.

As for whether or not there should be a pregap, you might as well just check the original disk.  It's possible whatever created that CUE sheet inserted the pregap for some arbitrary reason.  You probably already have a utility that can report the original track layout, but I would use ISOBuster.
This depresses me. I feel like a goldfish right now...

weissvulf

  • Sr. Member
  • ****
  • Posts: 324
  • Good news! An anomaly solved the enigma.
    • View Profile
Re: [PSX] Exchange CDDA tracks in PSOne games
« Reply #10 on: November 27, 2017, 04:46:10 am »
There are a few reasons Redump uses split track images. One big one being that computer CD drives have 'read offset' values and add or truncate tracks. Their listings have compensated for all drive variations one track at a time and represent perfect 1:1 copies of the originals. It also helps isolate where a game was changed. Many PS1 games had multiple versions released. Sometimes they include bug fixes, logo changes, or revised audio tracks.

None of those reasons are especially compelling. I honestly suspect they split the tracks mainly as a way to make them smaller for downloading (piracy). Redump itself doesn't support piracy in the slightest that I know of, but such 'perfect copy' databases invariably lead to people hosting pirate copies. Audio and data tracks have different optimal compression methods available, as well as being able to combine identical tracks between multiple releases of the same game.

Anyways, I think all those CUE sheets are showing roughly the same thing. Because Redump's cue sheets expect split files, they don't contain a 'track start' location, just a 'stack order'. Thus, swapping audio tracks should be as easy as changing the name in the cue file to reference the new track. All sizes and LBA stuff is adjusted automatically by the program opening the CUE.

Index00 is where the pregap (blank data leading into an audio track) starts. Index01 is where the actual audio data starts.

The second cue is designed for a 1 piece image and thus lists a track start location in minutes. The first entry lists the the prgap as 'PREGAP' whereas subsequent tracks use 'index 00' - same thing.

Pregaps aren't always detected properly by drives. I've even seen disks that have been mastered incorrectly showing no pre-gap, when they actually do have one. Again, audio data is handled sloppy by a lot of CD drives and dumping programs.

The third cue is also designed for a 1-pice image and appears to have the pre-gaps removed altogether. Its for the edited Rockman, correct? They probably just removed them, or didn't enter them by mistake. As far as I know, the pre-gaps don't serve any purpose on emulated CD drives (aka emulators, virtual drives etc).

TuF

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: [PSX] Exchange CDDA tracks in PSOne games
« Reply #11 on: November 27, 2017, 06:27:44 am »
@Jorpho
I tested the fixed version (I still don't know what has been fixed. It also wasn't stated in the topic) and the Rock Man X3 Rock version using the images and my PS3 Rebug (Cobra). The fixed version froze right at the "Now Loading" screen, whereas the rock version was played decently. By checking out the audio files of the rock version, I used UltraISO to gather a quick view of how the tracks are stored. They are just as stored as the original - in seperate tracks.

@weissvulf
By "1-piece-image" you refer to the audio tracks being stored as one big track? Because if so, the .CUE sheet doesn't make any sense for me, since they were stored seperately on the disc. The fixed version also stores the tracks one by one seperately. Don't get me wrong, I just try to understand the mechanics behind this before I'm going to build my version of the disc :D
« Last Edit: November 27, 2017, 07:53:24 am by TuF »

Jorpho

  • Hero Member
  • *****
  • Posts: 3858
  • The cat screams with the voice of a man.
    • View Profile
Re: [PSX] Exchange CDDA tracks in PSOne games
« Reply #12 on: November 27, 2017, 09:30:06 am »
By "1-piece-image" you refer to the audio tracks being stored as one big track? Because if so, the .CUE sheet doesn't make any sense for me, since they were stored seperately on the disc.
The audio tracks are not stored as "one big track"; they are simply stored together in the image, and if you mount the image (or burn the disc), you will see the separate tracks.  There's no reason to store the tracks separately unless you're manipulating the audio – or at least, that's what I thought until I read this information about the Redump Project. (It used to be common to rip the audio separately and store it as MP3 or OGG instead of WAV, in order to keep the file size down; many programs can automatically decompress such audio when reading the .CUE.)

There is plenty of documentation out there about CUE sheets if you are curious.  They have been around for a long time.
https://en.wikipedia.org/wiki/Cue_sheet_(computing)
This depresses me. I feel like a goldfish right now...

weissvulf

  • Sr. Member
  • ****
  • Posts: 324
  • Good news! An anomaly solved the enigma.
    • View Profile
Re: [PSX] Exchange CDDA tracks in PSOne games
« Reply #13 on: November 27, 2017, 04:49:26 pm »
Yes, I meant what Jorpho said.

The tracks are just a theoretical division on a CD like a table of contents. The CD is actually a long, 1-piece string of binary data. Playstation CD images are dumped in RAW mode, meaning the drive simply forwards the binary data as is, without removing sector headers or recognizing track boundaries etc. The name 'BIN' stands for binary to signify this. The CUE file is like a 'table of contents' for that long string of raw binary data.

If all the CD data is dumped into a single continuous file, the CUE sheet will contain the start locations for the tracks within that single file. If, when the CD was dumped, the data was split based on the track list (ie like splitting a single book into separate chapters), the CUE will reference the the name of the file where each track was saved.

When such a CUE is opened by an emulator etc, that program automatically joins (virtually) the separate files into a single binary chunk.