Page 1 of 3

Is CD+G possible?

Posted: Thu Jun 24, 2021 7:30 pm
by rhester72
I tried a CHD with CD+G subchannel data, and while the music played, the CD+G graphics did not...is there subchannel support in MegaCD for MiSTer?

Re: Is CD+G possible?

Posted: Thu Jun 24, 2021 8:43 pm
by zakk4223
No, there is not. The cd image handling code in Main doesn't deal with subcode data at all.
It looks like there may have been some thought of doing so, as there's some subcode related stuff in main, but it was all commented out and referenced other functions that don't exist. It looks like there may be support in the core itself, but I'm not sure how functional it is (I just quickly skimmed some of the vhd in the repo).

I'll try to track down a CD+G CHD image and see if I can send any data to the core

Re: Is CD+G possible?

Posted: Thu Jun 24, 2021 11:48 pm
by rhester72

Re: Is CD+G possible?

Posted: Sat Jun 26, 2021 11:05 pm
by zakk4223
The core had some subcode handling commented out, so I uncommented that and re-built the core.
I then extracted the subcode data out of the chd for each sector, and sent it to the core using the existing subcode data index.
And it...sorta works. The BIOS player TRIES to do something, but it never draws a coherent image.

So I'm not sure if it's a bug in the core (maybe it was all commented out for a reason...), or if I need to present the subcode data in some other format. Everything I can find says the SegaCD presents the 'raw interleaved' subcode data, and the BIOS is responsible for decoding it, but maybe there's something else going on.

Re: Is CD+G possible?

Posted: Sun Jun 27, 2021 2:02 am
by rhester72
I couldn't say - if I had danger money, it's that the BIOS code works (because, well, it's kinda known to LOL) and there's something up with how the core's presenting Q channel data. Not a big deal, was more a curio than anything...I've literally never seen it work outside real hardware, which is what drove the question. I sincerely appreciate you looking at it, though - maybe someday! =)

Re: Is CD+G possible?

Posted: Sun Jun 27, 2021 2:26 am
by dshadoff
You can't be sure that your original rip is presenting "correct" data (i.e. as the original hardware would have presented).
I understand that the ability to play CD+G discs was dropped at some point - because the drives themselves lost the ability (not because of the code required to render it, since that already existed). So any modern rip is suspect.

You would need to run a sample program on original hardware, comparing it with your modified core approach, against a known-good CD+G disc.
But since there are so few of those, it's hardly worth it in the first place...

Re: Is CD+G possible?

Posted: Sun Jun 27, 2021 2:56 am
by rhester72
Actually, that's not true at all - *any* drive can read the Q subchannel, it's just most rippers don't bother. CD+G died due to market indifference, not technology limitations. You can make your on CD+G to this day thanks to the ever-present Japanese interest in karaoke, and CD+G readers are still readily found (at least in the US) at Walmart and the like as kid's sing-along toys.

Re: Is CD+G possible?

Posted: Sun Jun 27, 2021 3:19 am
by dshadoff
It stopped being a function of CDROM drives built for PC's around the year 2000.
I'm not saying that it's impossible - but I'm *seriously* suspicious about any rip. And if said rip was actually good (and assumingthat writing a CD+G player was as straightforward as you say), it should be easy to find CD+G player software on the PC which would show the CD+G graphics from that rip.

Failing that...
The subcode-read functions are clearly documented in the PC Engine BIOS routines, so a sample program to read specific sectors on a real CD+G disc should produce the exact same data on a real machine + real CD+G disc (which I can test), versus a good rip. It would also be the way to validate that your core is sending the data back in the correct format.

I am not aware of anybody trying to verify in this way though. And I'm also not familiar with the MegaDrive/Genesis BIOS for a like-for-like comparison.

Re: Is CD+G possible?

Posted: Sun Jun 27, 2021 3:34 am
by dshadoff
So.. thinking about this a little bit more... how would one rip a CD+G to CHD format ?
I'm asking this because I have the Information Society CD+G sitting here and I'm curious to run the test I just suggested.

Re: Is CD+G possible?

Posted: Sun Jun 27, 2021 3:54 am
by zakk4223
It's probably pretty annoying, you have to find a ripper that even cares about subchannel data. I think cdrdao and derivates should be able to do it with the proper flags. Once you have the toc/bin, I think chdman can convert it.

Before you go too far along: you will never get consistent reads of R-W subchannel data on real hardware. That part has no error correction so there can be single bit errors (or even multi bit!) when reading. It's probably not enough to break things like CD+G (hopefully...) but it's likely enough to never get consistent checksums across multiple rips. It's certainly not consistent enough to compare a rip to a real disk+machine.

Re: Is CD+G possible?

Posted: Sun Jun 27, 2021 4:14 am
by dshadoff
I wasn't going to jump right into it; I was thinking about the overall approach that one might take, and how to build out those steps (which would likely end up being steps on a long-term plan, not short term).

I could certainly rip on a TurboGrafx, but getting the data off of the machine is not straightforward... which is why using it for comparison only - or for a sample extract of data - would be the approach I would likely take.

I have maybe 3 or 4 CD+G discs - all from between 1989 and 1992 - and I've played each of them exactly once (and have been left each time with a feeling of disappointment). The end result is absolutely not what would drive me; the technical challenge would be interesting though.
No particular rush.

Re: Is CD+G possible?

Posted: Sun Jun 27, 2021 4:43 am
by rhester72
Rip with CloneCD, convert to CHD, done. It's not particularly hard or exotic.

Re: Is CD+G possible?

Posted: Sun Jun 27, 2021 2:23 pm
by zakk4223
I got it working! Turns out the subcode handling in the core was slightly wrong and wasn't writing into the subcode buffer properly. I may have a lingering off-by-one error but that's a task for tomorrow...

Re: Is CD+G possible?

Posted: Sun Jun 27, 2021 3:59 pm
by rhester72
Wow, awesome! Great work!

Re: Is CD+G possible?

Posted: Mon Jun 28, 2021 12:40 am
by rhester72

Re: Is CD+G possible?

Posted: Mon Jun 28, 2021 3:06 am
by zakk4223
That one is a bad rip/image. Almost all of the R-W channel data is just repeating 0xFF bytes

Re: Is CD+G possible?

Posted: Mon Jun 28, 2021 3:54 am
by rhester72
Hrm. Not sure where I sourced that one from. Ignore. :)

Re: Is CD+G possible?

Posted: Mon Jun 28, 2021 4:57 am
by rhester72
I haven't done this in a good while (read: over 4 years), but this was my general workflow 'back in the day' to get from CloneCD rip to CHD:

- Install some sort of hypervisor to get to a target virtualized OS of Windows XP
- Mount the CloneCD image inside the virtualized XP via Virtual CloneDrive so that subchannel data is present on the virtualized CD inside the hypervisor
- Use the Win32 build of cdrdao to rerip in BIN/TOC format with subchannel data (i.e. --read-subchan rw_raw)
- Feed the TOC to chdman

I could have sworn I personally built both the CHD disc images I offered, but I remember both of them also being reversible and working, which clearly isn't the case for Hot Hits. I no longer have a suitable virtualized environment set up, but I do still have the original CloneCD rips.

Re: Is CD+G possible?

Posted: Mon Jun 28, 2021 2:49 pm
by rhester72
New attempts, new all-Linux process using cdemu with CloneCD rips and cdrdao:

https://www.rendezvo.us/cdg_try2/

I'm starting to question whether Hot Hits even *has* CD+G encoding or if I assumed it because the other disc in the sampler did. Trying to research that now.

Re: Is CD+G possible?

Posted: Mon Jun 28, 2021 2:57 pm
by rhester72
Ugh...confirmed:

https://www.discogs.com/Various-Hot-Hit ... e/10428334

Only Rock Paintings has CD+G encoding, the other is just a regular music CD.

Will see what I can scare up of other CD+G material (that isn't karaoke crap).

Re: Is CD+G possible?

Posted: Mon Jun 28, 2021 3:07 pm
by rhester72
I think I'm going to have to start eBaying some discs:

http://www.cdplusg.com/cdplusg/Main.html

Re: Is CD+G possible?

Posted: Mon Jun 28, 2021 4:35 pm
by dshadoff
Many of those have a non-CD+G pressing as well (even though this defies logic, as it would seem to be a re-mastering).
I am confident that I have several of those listed which don't have CD+G... but I can check by playing on my TurboDuo.

Re: Is CD+G possible?

Posted: Mon Jun 28, 2021 5:01 pm
by rhester72
It should have the CD+G logo right on the disc if it has the subchannels present.

Information Society is enroute.

Re: Is CD+G possible?

Posted: Mon Jun 28, 2021 5:23 pm
by dshadoff
I found that I have a non-CDG version of the 10,000 Maniacs disc - but the other 5 that I have from that list turned out to be real CD+G.
Not all were printed on the disc, but it's a good rule to follow.

Re: Is CD+G possible?

Posted: Mon Jun 28, 2021 5:28 pm
by rhester72
Any 'contributions' to the community you can make would be VERY appreciated, just sayin'. :) PM me offline if you need any assistance, it's pretty much science as of last night.

Re: Is CD+G possible?

Posted: Thu Jul 01, 2021 9:50 pm
by rhester72

Re: Is CD+G possible?

Posted: Thu Jul 01, 2021 10:26 pm
by rhester72
Lou Reed - New York and Little Feat - Hoy Hoy inbound.

I really, REALLY want this - anyone have access? :

http://www.cdplusg.com/cdplusg/Compilat ... nsion.html

Can't find it (standalone or even with a CD-i or Turbo Duo unit) anywhere at any price, even fleabay :P

Re: Is CD+G possible?

Posted: Thu Jul 01, 2021 10:43 pm
by rhester72
By the way, for those playing along at home, this has gotten SILLY stupid easy these days (not at all like two decades ago when I started with it!).

Get yourself a Raspberry Pi running Raspbian (pretty much any will do!), install cdrdao and mame-tools (to get chdman), plug in a USB CD drive (I haven't found one yet that *didn't* work), insert your shiny CD+G disc, and then...

sudo cdrdao read-cd --read-subchan rw_raw myrip.toc
chdman createcd -i myrip.toc -o myrip.chd

...and profit!

Fair warning: Only do 1 disc at a time. cdrdao creates two files, the toc file (whose name you specify) and data.bin (which you don't). That second filename will never change, so if you try to rip more than one disc (without creating subdirectories, at least) before you run chdman and clean up the original toc/bin, you'll end up potentially overwriting data.bin and end up with a mismatch between the TOC and the binary data (which isn't good!).

I assume it goes without saying that it'll help a great deal if your disc is clean (read: dirt, dust, and fingerprint-free)...there's about a zillion tutorials on the web about how to achieve that, but a microfiber cloth used from the inner ring towards the edge will generally get it done. This read method is a one-shot uncorrected, so any read errors WILL show up in the rip (generally as audio 'pops')...please don't let friends use dirty (or scratched) discs!

I could use a bit of help (re)building the world's CD+G library here, folks... =)

BTW, you'll know if your drive supports this if you see the following line during the cdrdao rip:

Code: Select all

PQ sub-channel reading (audio track) is supported, data format is BCD.
Short of playing the disc back in a CD+G capable device (or seeing the CD+G logo emblazoned on the disc, which *not all CD+G discs show!*), I'm not aware of a way to determine whether a given disc actually has CD+G content. I'm working off this site:

http://www.cdplusg.com/cdplusg/Main.html

which seems to be fairly exhaustive.

Re: Is CD+G possible?

Posted: Thu Jul 01, 2021 11:14 pm
by dshadoff
What software can play back CHD-format CD+G's ?
In other words, assume we can get through the rip process; how do we verify (through playback) that it was OK ?
I don't think @zakk4223 's MegaCD revision has been committed/released yet.

Re: Is CD+G possible?

Posted: Fri Jul 02, 2021 12:25 am
by rhester72
@dshadoff - well, not TGFX16 (yet), I tried and it locked up entirely. LOL

I'm going to try some recent-ish MAME drivers in a bit, because I agree that validation would be a nice thing to have.

EDIT: MAME's segacd/megacd driver doesn't, will try TG16-CD (if MAME even has a driver) a bit later.