How to pad ISO9660 to fit into MODE2/2336 data track in a cue sheet?

56 Views Asked by At

first and foremost here's the setting of my problem.

I have been given a heavily scratched CD with the task to salvage the data and create a good, working copy. This CD even has its top layer missing, but only in a few spots on the outer rim. I found another copy of it online, however the online copy is missing 2 seconds of the first audio track and 300 last sectors from the data track, so it's not really a good copy.

Reading the scratched disc with cdrdao and Alcohol 120% got me really mixed results. The data track is good, spot on. By using cdparanoia, I was able to dump the audio tracks from the scratched CD and these are in perfect condition. For the purpose of comparing the contents of the 2 copies' data track, I have dumped them into an ISO9660 file and turns out the extra sectors is Joliet data, but other than that all files are the same in both copies. The audio tracks from the original CD dumped by cdparanoia have the missing 2 seconds the online copy doesn't have, and they do not have any defects that cdrdao and A120 got me.

So now, I want to combine the pieces together. I have the most 1:1 copy of the ISO9660 part of the scratched disc without defects, and the soundtrack without defects and without missing parts. So I made this cuesheet:

FILE "track01.iso" BINARY
    TRACK 01 MODE1/2048
        INDEX 01 00:00:00
FILE "track02.cdda.wav" BINARY
    TRACK 02 AUDIO
        PREGAP 00:02:00
        INDEX 01 00:00:00
FILE "track03.cdda.wav" BINARY
    TRACK 03 AUDIO
        INDEX 01 00:00:00

It's just a fragment though, with only the relevant parts to the question.

However, we know that mixed mode CDs do not keep the data track in MODE1/2048, instead they go for something like MODE2/2352 or MODE2/2336. What can I do to produce a cuesheet that's going to keep the perfect soundtrack and the iso file, but correctly cast the data track into MODE2/2336? I tried to just change the track's mode and mount that cuesheet with cdemu, but the resulting disc had a data track that couldn't be accessed. Am I missing something? Do I need to convert the iso file into a mode2 iso? And how do I even do that?

I tried changing the mode in the cuesheet but that only got me an unusable data track.

1

There are 1 best solutions below

0
On

Alright, I seem to have it solved. I needed to establish some things.

The data track's original mode is MODE2/2352, so 2352 is the sector size, despite what software have you believe about CDROM sector sizes.

Next, there exists a pregap of 2 seconds between track 1 (data) and track 2 (audio). We know CD audio tracks are 44100Hz 16 bit stereo tracks. That means, each second of audio is 44100 * 16 bits * 2 channels = 44100 per second * 2 bytes per channel * 2 channels = 4*44100.

With this knowledge, we can do the following computation: mode's_sector_size (it is 2352) * size_of_data_track_in_sectors - (4*44100 (bytes per second) * 2 (seconds))

to receive the size in bytes of how much we need to copy from the cdrdao dump to receive just the data track that fits perfectly into our cuesheets data track.