musicbymuzak wrote:At first I thought the 500mb "music" file on an AEI Prodisc was just an XA audio file, since PSMplay can play it and shows 4 51min tracks. But any XA audio file made from a WAV at the same sampling rate wouldn't work in PsmPlay.
I've forgotten most details but the music file would be a large file with 4 tracks of interleaved ADPCM encoded data. This is a real-time-file, i.e. it gets played at single speed i.e. 75 sectors per second. It's stored on the disc as Mode 2 Form 2 (M2F2), i.e. 2324 bytes of data per sector instead of the 2048 that are usual for CD-ROM (so to extract the file from the disc, you need a program that knows how to extract M2F2 sectors). Because the file is played in real-time and ADPCM is 4:1 compressed, it's possible to put 4 (mono) tracks of ADPCM in a single file. Each sector has 4 ADPCM frames; one for each audio track. The Green Book describes how ADPCM is encoded and interleaved.
I know many people refer to PCM files as WAV files and PCM files (i.e. with uncompressed audio data) are usually stored as WAV files but a WAV file can contain other data too. Replacing the music file of a BGM disc with PCM data wouldn't work because (1) it's not ADPCM (2) it's not interleaved and (3) the information in the other files won't match your music file. Also (4) to make the BGM disc play on an actual BGM player, some files need to be in the right locations on the disc.
It should be possible and not too hard to encode ADPCM from any music data, and use a simple program to interleave it into a file that could be used on your own BGM disc. That would solve problem 1 and 2. But you would still need to solve problems 3 and possibly 4.
I thought I would be clever and simply make one giant XA file and swap it out within the CDi image of a 'working' BGM disc, but the genuine MUSIC file has all the song, artist and label info embedded in a header; I can't tell where the actual audio data begins or ends. There went that idea.
Are you sure that the music file has a header on your disc? I'm quite sure that song, artist and title data is stored in separate files (stored in Mode 2 form 1) to make sure that the information can be read without a chance that it might get corrupted. If you're seeing non-ADPCM data in the music file on your disc, it may be because the disc producer made a mistake when mastering, or it may be because they wanted to add some redundancy or it may be because they wanted to make the music more difficult to copy or something.
That being said, the file that contains the track/artist info contains time codes if I recall correctly, and it's definitely possible to make the first song of each track start at a different location than the first sector, so the BGM player and CD-i player can definitely deal with garbage at the beginning of the music file -- they just skip it if the time codes tell it to do so.
The discs do seem to follow the basic standard, with some seemingly empty files from 1992ish and 3 that are always updated in addition to MUSIC.
REMIXSEQ, PATH_TBL, BGMINDEX.PRO, and MUSIC are always dated the same month the disc is marked for.
They always have different data within them, so it stands to reason they're created at the same time MUSIC is. I just have no idea what relation these files have to each other, aside from speculation.
The path_tbl file (as well as "album" "author" "manufacturer") are standard CD-i files described in the Green Book. I don't remember which files are required for BGM discs and the Green Book PDF that I just found online doesn't have any information about BGM (I think it was a separate attachment that came later, but I don't remember).
I expect that BGMINDEX.PRO contains track information in ASCII. It's possible that time codes are stored as binary codes or as BCD codes (e.g. 0x123456 means 12 minutes, 34 seconds and 56 sectors; there are 75 sectors in a second and there are 2324 bytes per sector, of which I think 2304 bytes are used for four ADPCM frames). Either way the time codes are probably offsets in terms of sectors, stored in Big Endian format because the CPU was a 68000. Probably the information for each title on the disc takes up the same number of bytes in the file.
I get the impression that the 76kb music player from 1995, included on every one of these discs, was based on the original 1989 CD-I music player application, adapted for AEI's purposes, and eventually supposed to enable sophisticated features on later machines. It seems to have provisions for recognising a non-AEI player (so it would crash a home CD-I player; it won't work when I try to get a CD-I emulator to run it), "expiring" a disc based on date-time, enable different remix sequences based on the day; and relies on three files to tell it what to do. "RemixSEQ" tells it to sequence a set of four folders (CBCACDC for example, if folder "C" contained popular music and "B" not so much); and "BGMINDEX" may act like a TOC, that tells the player where each song is within the folders in the MUSIC suitcase. "PATH_TBL" may be for defining paths. I have a feeling the disc mastering program would dump the song info plus raw music into the MUSIC suitcase, then generate the other 3 files based on what was in there.
I don't remember seeing the REMIXSEQ file, I speculate that that might be a specific feature for the program that's on your disc. It's possible that the producer of your disc added special features that weren't required by the standard BGM format.
Jac, do you recall any names of the mastering or creation programs? I would reeeeallly love to create CD-BGMs if only for the novelty!
As far as I know, there were no public programs to master CD-i's specifically for BGM. At Codim, we just used the standard OptImage mastering tools with an input file that was probably either the same for each disc, or was automatically modified to adapt to the differences between discs. I think BGM required certain files (presumably the BGMINDEX.PRO file and the music file) to start at a certain location on the disc, and that was easy to accomplish with the OptImage tools.
Hope this helps!