# Codes and Identifiers

## CDTOC – Compact Disc Table of Contents

* Contains a list of absolute track start positions on an audio CD.
* Used to identify audio CDs based on the number of tracks and their lengths in order.
* Measured in frames where:
    * 1 frame = 588 samples
    * 1 frame = 1 sector
    * 75 frames = 1 second
* Can be encoded in various formats:
    * MusicBrainz
    * AccurateRip
    * CueTools
    * Gracenote
    * FreeDB / GnuDB
    * MCDI

## Label Code

* 4-digit or 5-digit code prefixed with "LC-".
* Used to identify music labels.

## CatNo, Cat# – Catalog Number

* Used to identify releases within and between music labels.
* Usually consists of a label abbreviation and a product number.
* Usually printed on the spine and back of CD cases.
* Sometimes contains a code marking the release medium.
* Sometimes ends with a number delimited by "-" or "~", denoting multiple sequential catalog numbers for one release.
* Not unique across labels.
* No standard format.

## ISRC – International Standard Recording Code

* Used to identify sound recordings.
* 12-character alphanumeric uppercase code formatted like "CCXXXYYNNNNN":
    * "CC" is the country code.
    * "XXX" is the issuer code within the country.
    * "YY" is the last 2 digits of the year.
    * "NNNNN" is an identifier for the recording within the year.

## ISWC - International Standard Musical Work Code

* Used to identify musical works / compositions.
* 11-character alphanumeric uppercase code formatted like "T-XXX.XXX.XXX-C":
    * "T" is the type code, literal "T".
    * "XXXX" is the work identifier.
    * "C" is the check digit.

### Calculating Check Digits for ISWC Codes

1. All work identifier digits are multiplied by their integer weight.
2. Multiplication results are summed.
3. The sum is subtracted from the nearest multiple of 10 not smaller than the sum.

## ISBN – International Standard Book Number

* Used to identify books.
* 10-digit code ending with a check digit.

### Calculating Check Digits for ISBN Codes

1. All digits are multiplied by their integer weight.
2. Multiplication results are summed.
3. The sum is subtracted from the nearest multiple of 11 not smaller than the sum.

## ASIN – Amazon Standard Identification Number

* Used to identify products on Amazon.
* 10-character base36 uppercase code.
* All products (except books) start with "B".
* Books use ISBNs in place of ASINs.
* All ISBNs are valid ASINs.

## GTIN – Global Trade Item Number

* Used to identify general trade goods.
* Primarily used within barcodes.
* X-digit code ending with a check digit.
* Begins with a [3 digit country code](https://en.wikipedia.org/wiki/List_of_GS1_country_codes), sometimes denoting categories besides countries.

    | Code    | Formerly                            | Symbologies    | Notes                                                                                                                                    |
    |---------|-------------------------------------|----------------|------------------------------------------------------------------------------------------------------------------------------------------|
    | GTIN-14 | EAN/UCC-14                          | ITF-14         | <ul><li>GTIN-13 if starts with zero.</li><li>Used for wholesale packaging.</li></ul>                                                     |
    | GTIN-13 | <nobr>EAN/UCC-13</nobr><br>(JAN-13) | EAN-13         | <ul><li>GTIN-12 if starts with zero.</li><li>JAN-13 if starts with "45" or "49" for Japan.</li><li>Used outside North America.</li></ul> |
    | GTIN-12 | EAN/UCC-12                          | UPC-A<br>UPC-E | <ul><li>UPC-E is a compacted 6-digit code meant for small packages.</li><li>Used in North America.</li></ul>                             |
    | GTIN-8  | EAN/UCC-8                           | EAN-8          | <ul><li>Used for small packages.</li></ul>                                                                                               |

### Calculating Check Digits for GTIN Codes

1. All digits are multiplied by an alternating (3 or 1) weight, which is always 3 for the last digit.
2. Multiplication results are summed.
3. The sum is subtracted from the nearest multiple of 10 not smaller than the sum.

{{ pageinfo(updated="2022/03/18") }}

[^1]: <https://ibcaweb.org/guide/guide_mfr/ch4.htm>
[^2]: <https://barcodeguide.seagullscientific.com/Content/EAN-UCC.htm>
