Is CD+G possible?

rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Is CD+G possible?

Unread post 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?
zakk4223
Posts: 270
Joined: Sun May 24, 2020 10:55 pm
Been thanked: 107 times

Re: Is CD+G possible?

Unread post 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
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post by rhester72 »

zakk4223
Posts: 270
Joined: Sun May 24, 2020 10:55 pm
Been thanked: 107 times

Re: Is CD+G possible?

Unread post 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.
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post 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! =)
dshadoff
Core Developer
Posts: 534
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 19 times
Been thanked: 141 times

Re: Is CD+G possible?

Unread post 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...
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post 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.
dshadoff
Core Developer
Posts: 534
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 19 times
Been thanked: 141 times

Re: Is CD+G possible?

Unread post 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.
dshadoff
Core Developer
Posts: 534
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 19 times
Been thanked: 141 times

Re: Is CD+G possible?

Unread post 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.
zakk4223
Posts: 270
Joined: Sun May 24, 2020 10:55 pm
Been thanked: 107 times

Re: Is CD+G possible?

Unread post 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.
dshadoff
Core Developer
Posts: 534
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 19 times
Been thanked: 141 times

Re: Is CD+G possible?

Unread post 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.
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post by rhester72 »

Rip with CloneCD, convert to CHD, done. It's not particularly hard or exotic.
zakk4223
Posts: 270
Joined: Sun May 24, 2020 10:55 pm
Been thanked: 107 times

Re: Is CD+G possible?

Unread post 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...
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post by rhester72 »

Wow, awesome! Great work!
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post by rhester72 »

zakk4223
Posts: 270
Joined: Sun May 24, 2020 10:55 pm
Been thanked: 107 times

Re: Is CD+G possible?

Unread post by zakk4223 »

That one is a bad rip/image. Almost all of the R-W channel data is just repeating 0xFF bytes
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post by rhester72 »

Hrm. Not sure where I sourced that one from. Ignore. :)
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post 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.
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post 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.
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post 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).
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post by rhester72 »

I think I'm going to have to start eBaying some discs:

http://www.cdplusg.com/cdplusg/Main.html
dshadoff
Core Developer
Posts: 534
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 19 times
Been thanked: 141 times

Re: Is CD+G possible?

Unread post 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.
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post by rhester72 »

It should have the CD+G logo right on the disc if it has the subchannels present.

Information Society is enroute.
dshadoff
Core Developer
Posts: 534
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 19 times
Been thanked: 141 times

Re: Is CD+G possible?

Unread post 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.
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post 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.
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post by rhester72 »

rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post 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
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post 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.
dshadoff
Core Developer
Posts: 534
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 19 times
Been thanked: 141 times

Re: Is CD+G possible?

Unread post 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.
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Is CD+G possible?

Unread post 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.
Post Reply