IPB

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
CD TOC storage in lossless files, Proposed Standard
spoon
post Dec 13 2007, 16:12
Post #1


dBpowerAMP developer


Group: Developer (Donating)
Posts: 2352
Joined: 24-March 02
Member No.: 1615



As it stands very few (tagging formats) have provisions to store CD TOC (CD Table of Contents) in the ID Tags, why is it important? the TOC allows for precise identification of an audio file, freedb ID / any online meta data provider, even Accuraterip IDs can be all calculated with the TOC without the need for the CD. Time to clear up the mess that exists.

Those with CD TOCs storing abilities:

Any Id3v2 format (mp3)
WMA **
Wave ++
iTunes Tagging (m4a)

Those without:

Vorbis Comments (ogg, flac)
(ape2) Wavpack, musepack

------
2 'Standards' of storing the CD TOC:

CD drives give out 2 table of contents, either LBA (logical block address) or MSF (minute seconds frames), one can be calculated from the other: for example: 0 LBA = 0 / 2 / 0 MSF (or 2 seconds in). This is given out by the CD drive its self.

Here is where it gets complex, 2 seconds in (MSF) really is 150 LBA (if you take the disc start into account), the reason CD drives return 0 LBA, is for a valid audio CD it has to have 2 seconds of lead-in, anything less is not valid, so everything is referenced from 0 LBA, not 150 LBA.

Many metadata providers use 150 as the starting point when calculating the database identifier (such as freedb id), there is considerable confusement about which should be stored. After much research (existing programs) it seems there are 2 standards:

If the raw (as I call it, or untouched LBA toc is to be stored, ie a binary TOC) it should be stored as is, no adding of 150, to my best knowledge Cdex and Audiograbber both do this in ID3v2.

If a string representation is to be used (ie like WMA which is the only one), then that standard is:

TrackCount + (LBA0+150) + (LBA1+150)

..but stored in Hex, so a 2 track cd might be:

2+96+4901+811E

There is a slight issue if a CD-extra TOC is to be stored, this is another matter and I will post about it later.

-----------

Proposed new standards (we will implement these by Jan 2008)

APE2: Nice an easy, lets call the field 'cdtoc' (unless someone is storing already) and store as a binary item (raw untoched CD TOC).

Ogg Vorbis: Vorbis comments are 'stuck in a rut' if you ask me, not even able to decide simple standards such as Album Artist, Ratings, Album Art, Disc Count, Track Total.
Anyhow, VC cannot have binary items, so go with the WMA string representation as above, call the field 'cdtoc'.

FLAC: 2 choices here, either go the same as Ogg Vorbis, or make a special 'chunk' area like with Album Art, Cue Sheets, etc, it should not really go in RIFF chunks as they do not need to go back to wav files.

iTunes Tagging: Seems to be done, a little like WMA using the rare field iTunes_CDDB_1, Chungalin says it is:
- CDDB ID
- Leadout sector LBA address
- Number of tracks
- For each track: starting track sector LBA address

ie: 9D07F70B+153089+11+150+12007+27749+43216+55300+66449+81003+96490+10955 1+125279+142145

------

** Highlighting WMA as Microsoft's left hand, does not know what the right hand is doing:

http://msdn2.microsoft.com/en-us/library/aa391939.aspx

Basically it says that WM/MCDI should be the same as ID3v2, ie a binary dump, but WMP11 is storing as a unicode string, nothing binary about it at all, also it is worth noting WMP is adding 150 to each LBA address (see above).

-----

++ There are a number of wave tagging standards, BWF, Cart, INFO List, even 'tag ' (id3v2 chunk). There is provision to store the toc if 'tag ' is used, so wave is covered.

-----

References:

http://musicbrainz.org/doc/DiscIdsAndTagging

This post has been edited by spoon: Dec 13 2007, 16:18


--------------------
Spoon http://www.dbpoweramp.com
Go to the top of the page
 
+Quote Post
benski
post Dec 13 2007, 16:30
Post #2


Winamp Developer


Group: Developer
Posts: 466
Joined: 17-July 05
From: Ashburn, VA
Member No.: 23375



It is also important to save the original track number somewhere safe. It's quite conceivable that a user might have purposefully or accidently changed the track number (such as re-tagging a song from a compilation with metadata from the album release, or renumbering Disc 2 of a 2CD set to follow the last track # of Disc 1).
Go to the top of the page
 
+Quote Post
skamp
post Dec 13 2007, 19:09
Post #3





Group: Members
Posts: 617
Joined: 4-May 04
From: Paris, France
Member No.: 13875



Ahem. Where have you been? I spent many hours on that, asked for your input, to no avail. And now, over 3 months later, you wake up and decide to take matters into your own hands?

This post has been edited by skamp: Dec 13 2007, 19:21
Go to the top of the page
 
+Quote Post
jcoalson
post Dec 13 2007, 20:29
Post #4


FLAC Developer


Group: Developer
Posts: 1523
Joined: 27-February 02
Member No.: 1408



spoon aside from multi-session discs, is there anything in the CD TOC that is not represented in the FLAC CUESHEET metadata block? I thought I covered everything.
http://flac.sourceforge.net/format.html#me..._block_cuesheet

because CUESHEET has special support in libFLAC, it allows the encoder to do neat things like create optimal seek points, and the decoder to easily cue by track/index, compute disc IDs, etc without a lot of extra code.
Go to the top of the page
 
+Quote Post
skamp
post Dec 13 2007, 20:56
Post #5





Group: Members
Posts: 617
Joined: 4-May 04
From: Paris, France
Member No.: 13875



QUOTE (jcoalson @ Dec 13 2007, 20:29) *
aside from multi-session discs

That's a pretty big aside. You can't identify any so-called "Enhanced-CD" (and there are many of those out there) just from cue sheets, internal or external.

QUOTE (jcoalson @ Dec 13 2007, 20:29) *
is there anything in the CD TOC that is not represented in the FLAC CUESHEET metadata block? I thought I covered everything.

Cue sheets do not contain information that could be used reliably to determine LBAs, especially when there are exotic discs with negative values.

QUOTE (jcoalson @ Dec 13 2007, 20:29) *
because CUESHEET has special support in libFLAC, it allows the encoder to do neat things like create optimal seek points, and the decoder to easily cue by track/index, compute disc IDs, etc without a lot of extra code.

Cue sheets and TOCs have different uses. The former are indeed very practical (along with FLAC's neat API and tools) for cutting tracks, specifying pre-emphasis flags, etc... The latter only serve as reliable identification for use with internet databases such as MusicBrainz and FreeDB, or even local ones.
Go to the top of the page
 
+Quote Post
jcoalson
post Dec 13 2007, 23:49
Post #6


FLAC Developer


Group: Developer
Posts: 1523
Joined: 27-February 02
Member No.: 1408



as I understand it, LBA numbering is done by the drive, it's not an inherent feature of the disc. the FLAC CUESHEET has the lead-in size from the absolute start of the disc, so it can be used to compute all disc IDs according to their assumption about the program area starting at LBA 0 or 150.

I thought enhanced CDs are just single session with a data track as the last track. FLAC's CUESHEET handles that case.

anyway for multi-session discs is the plan to store multiple TOCs? I don't see that addressed in spoon's or skamp's proposal.
Go to the top of the page
 
+Quote Post
eevan
post Dec 14 2007, 00:12
Post #7





Group: Members
Posts: 497
Joined: 9-April 07
From: Belgrade, Serbia
Member No.: 42357



If we are talking about audio CDs that can be played in an ordinary CD player, than only the first session of a multi-session CD is seen by the player. So I think that there's no point in storing TOCs for other sessions.

This post has been edited by eevan: Dec 14 2007, 00:14


--------------------
If age or weaknes doe prohibyte bloudletting you must use boxing
Go to the top of the page
 
+Quote Post
greynol
post Dec 14 2007, 00:19
Post #8





Group: Super Moderator
Posts: 6288
Joined: 1-April 04
Member No.: 13167



QUOTE (jcoalson @ Dec 13 2007, 14:49) *
as I understand it, LBA numbering is done by the drive, it's not an inherent feature of the disc. the FLAC CUESHEET has the lead-in size from the absolute start of the disc, so it can be used to compute all disc IDs according to their assumption about the program area starting at LBA 0 or 150.
The length of the disc is also provided in the TOC and is necessary in order to calculate a disc ID but is not included in a CUE sheet and apparently has no provision in the organization of your metadata.

QUOTE (jcoalson @ Dec 13 2007, 14:49) *
I thought enhanced CDs are just single session with a data track as the last track. FLAC's CUESHEET handles that case.
The enhanced data is stored in a new session.

This post has been edited by greynol: Dec 14 2007, 00:20


--------------------
0096225121108105
Go to the top of the page
 
+Quote Post
Eli
post Dec 14 2007, 00:23
Post #9





Group: Members
Posts: 898
Joined: 16-October 03
Member No.: 9337



QUOTE (eevan @ Dec 13 2007, 18:12) *
If we are talking about audio CDs that can be played in an ordinary CD player, than only the first session of a multi-session CD is seen by the player. So I think that there's no point in storing TOCs for other sessions.


the point is to be able to uniquely identify the data that came from THAT disc and associate meta data with it.


--------------------
http://forum.dbpoweramp.com/showthread.php?t=21072
Go to the top of the page
 
+Quote Post
jcoalson
post Dec 14 2007, 00:27
Post #10


FLAC Developer


Group: Developer
Posts: 1523
Joined: 27-February 02
Member No.: 1408



QUOTE (greynol @ Dec 13 2007, 18:19) *
QUOTE (jcoalson @ Dec 13 2007, 14:49) *
as I understand it, LBA numbering is done by the drive, it's not an inherent feature of the disc. the FLAC CUESHEET has the lead-in size from the absolute start of the disc, so it can be used to compute all disc IDs according to their assumption about the program area starting at LBA 0 or 150.
The length of the disc is also provided in the TOC and is necessary in order to calculate a disc ID but is not included in a CUE sheet and apparently has no provision in the organization of your metadata.
FLAC's CUESHEET also stores the CD TOC's leadout track (offset, track number, etc) from the which the length can be computed according to the disc id methodology.
Go to the top of the page
 
+Quote Post
greynol
post Dec 14 2007, 00:40
Post #11





Group: Super Moderator
Posts: 6288
Joined: 1-April 04
Member No.: 13167



Then you have the added complication that gaps may be left out, ripped individually or prepended to the current track; or is this discussion limited to single-file images?

This post has been edited by greynol: Dec 14 2007, 00:41


--------------------
0096225121108105
Go to the top of the page
 
+Quote Post
jcoalson
post Dec 14 2007, 02:28
Post #12


FLAC Developer


Group: Developer
Posts: 1523
Joined: 27-February 02
Member No.: 1408



ah yes, the CUESHEET block is only for single file images. that's a problem if you want to store the TOC in individual tracks.
Go to the top of the page
 
+Quote Post
skamp
post Dec 14 2007, 03:30
Post #13





Group: Members
Posts: 617
Joined: 4-May 04
From: Paris, France
Member No.: 13875



QUOTE (jcoalson @ Dec 14 2007, 00:27) *
FLAC's CUESHEET also stores the CD TOC's leadout track (offset, track number, etc) from the which the length can be computed according to the disc id methodology.

No, it actually stores the point at which the audio ends, which isn't even the CD's first session real lead-out value. And it doesn't give any useful value about the second session either, even with an external cue sheet.

I've spent many hours browsing through documentation, testing, coding, etc... I wish we wouldn't waste time AGAIN debating the merits of FLAC's CUESHEET metadata block or MCDI's binary TOC.
Go to the top of the page
 
+Quote Post
jcoalson
post Dec 14 2007, 05:27
Post #14


FLAC Developer


Group: Developer
Posts: 1523
Joined: 27-February 02
Member No.: 1408



QUOTE (skamp @ Dec 13 2007, 21:30) *
QUOTE (jcoalson @ Dec 14 2007, 00:27) *
FLAC's CUESHEET also stores the CD TOC's leadout track (offset, track number, etc) from the which the length can be computed according to the disc id methodology.
No, it actually stores the point at which the audio ends, which isn't even the CD's first session real lead-out value.
for CDDA the FLAC leadout track is track 170 in the CD TOC. if you 'metaflac --list' a flac image with a CUESHEET block you'll see the track 170. if that's not where the leadout is specified in the CD TOC, then where is it?
Go to the top of the page
 
+Quote Post
Eli
post Dec 14 2007, 12:26
Post #15





Group: Members
Posts: 898
Joined: 16-October 03
Member No.: 9337



QUOTE (jcoalson @ Dec 13 2007, 20:28) *
ah yes, the CUESHEET block is only for single file images. that's a problem if you want to store the TOC in individual tracks.


We are talking about single tracks.


--------------------
http://forum.dbpoweramp.com/showthread.php?t=21072
Go to the top of the page
 
+Quote Post
spoon
post Dec 14 2007, 16:25
Post #16


dBpowerAMP developer


Group: Developer (Donating)
Posts: 2352
Joined: 24-March 02
Member No.: 1615



Depends on what the CD TOC identifier is to be used for, if it is later lookup of online databases the a string tag of:

10+150+1023+1204...

Is fine, even for CD extra. To preserve a CD extra disc 100%, you would need an extended TOC (or full session TOC), which I think is beyond the scope of this and complicates it too much.


--------------------
Spoon http://www.dbpoweramp.com
Go to the top of the page
 
+Quote Post
Eli
post Dec 22 2007, 15:21
Post #17





Group: Members
Posts: 898
Joined: 16-October 03
Member No.: 9337



what is the status on this? Is there a consensus?


--------------------
http://forum.dbpoweramp.com/showthread.php?t=21072
Go to the top of the page
 
+Quote Post
skamp
post Dec 22 2007, 19:15
Post #18





Group: Members
Posts: 617
Joined: 4-May 04
From: Paris, France
Member No.: 13875



I guess we'll have to wait another 3 months to find out rolleyes.gif
Go to the top of the page
 
+Quote Post
Eli
post Jan 20 2008, 16:28
Post #19





Group: Members
Posts: 898
Joined: 16-October 03
Member No.: 9337



I would like to bring this up again as it has again been dropped with out any final resolution that I am aware of.


--------------------
http://forum.dbpoweramp.com/showthread.php?t=21072
Go to the top of the page
 
+Quote Post
Eli
post Feb 17 2008, 14:24
Post #20





Group: Members
Posts: 898
Joined: 16-October 03
Member No.: 9337



nearly a month since my last bump and its still unclear if this has been resolved.


--------------------
http://forum.dbpoweramp.com/showthread.php?t=21072
Go to the top of the page
 
+Quote Post
spoon
post Feb 18 2008, 14:38
Post #21


dBpowerAMP developer


Group: Developer (Donating)
Posts: 2352
Joined: 24-March 02
Member No.: 1615



When I next update FLAC and Ogg (under 4 weeks) I will side with 1 of the methods text methods, it looks like the most compatible with other taggers. The only choice is either the WMA or m4a iTunes standard.


--------------------
Spoon http://www.dbpoweramp.com
Go to the top of the page
 
+Quote Post
Eli
post Feb 29 2008, 17:26
Post #22





Group: Members
Posts: 898
Joined: 16-October 03
Member No.: 9337



ok, just wanted to be sure something has been / is being done.


--------------------
http://forum.dbpoweramp.com/showthread.php?t=21072
Go to the top of the page
 
+Quote Post
spoon
post Apr 3 2008, 14:30
Post #23


dBpowerAMP developer


Group: Developer (Donating)
Posts: 2352
Joined: 24-March 02
Member No.: 1615



Now done, we have a new tag:

CDTOC

see: http://forum.dbpoweramp.com/showthread.php?p=76686#post76686


--------------------
Spoon http://www.dbpoweramp.com
Go to the top of the page
 
+Quote Post
skamp
post Apr 3 2008, 14:54
Post #24





Group: Members
Posts: 617
Joined: 4-May 04
From: Paris, France
Member No.: 13875



7 months for *that*? Gee spoon, thanks!
As usual, you've gone at it on your own. Now, I'd like to know how we're supposed to compute FreeDB DiscIDs without a lead-out address? Without first and last track numbers, how are we supposed to compute MusicBrainz DiscIDs? How are we supposed to handle discs with a data track as track 01? Discs with negative LBAs?

This post has been edited by skamp: Apr 3 2008, 14:57
Go to the top of the page
 
+Quote Post
spoon
post Apr 3 2008, 15:14
Post #25


dBpowerAMP developer


Group: Developer (Donating)
Posts: 2352
Joined: 24-March 02
Member No.: 1615



>As usual, you've gone at it on your own.

The whole point of this post 7 months ago was to allow an official standard, didn't come so of course I had to do something on my own...dammed if you don't....dammed if you do?

>Discs with negative LBAs?

They do not exist, stored as raw LBA address + 150, so if you had a disc which started 1 second in, not 2 seconds, if there was a disc it would start as 75.

>How are we supposed to handle discs with a data track as track 01?

I have yet to double check how Windows Media Player is storing, these discs are basically only Playstation CDs so I am not too concerned.

>Without first and last track numbers

The first track is 1, always is.

>how are we supposed to compute MusicBrainz DiscIDs?

Possible with the CDTOC tag, even for cd extra, as MB does not use the data track, see the CD Extra I gave an example for:

http://musicbrainz.org/show/release/detail...ow=times#discid

CODE
13 51:08 4:10 3:39 3:12 4:03 3:37 3:59 4:22 3:21 3:56 4:35 4:04 4:10 3:57


LBA FirstIndex: 1 last Index: 14
Type: Audio Track 1 LBA Address: 0 Length: 00:04:10.413
Type: Audio Track 2 LBA Address: 18781 Length: 00:03:39.093
Type: Audio Track 3 LBA Address: 35213 Length: 00:03:11.534
Type: Audio Track 4 LBA Address: 49578 Length: 00:04:03.426
Type: Audio Track 5 LBA Address: 67835 Length: 00:03:36.894
Type: Audio Track 6 LBA Address: 84102 Length: 00:03:59.080
Type: Audio Track 7 LBA Address: 102033 Length: 00:04:21.773
Type: Audio Track 8 LBA Address: 121666 Length: 00:03:21.227
Type: Audio Track 9 LBA Address: 136758 Length: 00:03:56.213
Type: Audio Track 10 LBA Address: 154474 Length: 00:04:35.240
Type: Audio Track 11 LBA Address: 175117 Length: 00:04:04.000
Type: Audio Track 12 LBA Address: 193417 Length: 00:04:09.947
Type: Audio Track 13 LBA Address: 212163 Length: 00:03:55.160
Type: Data Track 14 LBA Address: 229950 Length: 00:11:29.480
Type: Lead Out LBA Address: 281511

CDTOC=D+96+49F3+8A23+C240+10991+1491C+18F27+1DBD8+216CC+25C00+2ACA3+2F41F+33D59+382D4


--------------------
Spoon http://www.dbpoweramp.com
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 2nd September 2010 - 15:56