Skip to content

Artists and credits

Every credit in the output is an Artist:

{ name: string; role: "primary" | "featured" | "producer" | "remixer"; joiner: string | null; source: "artist" | "title" | "version" }

role says what the person did. joiner is the text that introduced the name, exactly as written ("&", ",", "ft.", "prod. by"), and null for the first name of a list (None in Python and Rust, nil in Go, where Joiner is a *string, NULL in C, where joiner is a const trackparse_str *). source says where the credit was found: left of the dash (artist), right of it (title), or inside a version (version). In Rust, role and source are the enums ArtistRole and ArtistSource; as_str() and Display give the lowercase names used here. In Go they are the string types Role and Source, with constants such as trackparse.RolePrimary and trackparse.SourceTitle whose values are those names. In C they are the enums trackparse_role and trackparse_source (TRACKPARSE_ROLE_PRIMARY, TRACKPARSE_SOURCE_TITLE), and trackparse_role_name() and trackparse_source_name() give the names; the structs are in trackparse.h. The full field list is under Artist in the reference.

Remixers live inside versions, not in artists. Use allArtists(track) (all_artists in Python and Rust, AllArtists in Go, trackparse_all_artists in C) when you want everyone in one list.

&, x, vs., ,, ;, +, / and and separate names, and so do b2b, meets, pres. and the others in joiners.json. They're joiners, not roles: every name they produce is still primary.

import { parse, parseArtists } from "trackparse";
parse("Skrillex & Diplo x Justin Bieber - Where Are Ü Now").artists.map((a) => [a.name, a.joiner, a.role]);
// [ [ 'Skrillex', null, 'primary' ], [ 'Diplo', '&', 'primary' ], [ 'Justin Bieber', 'x', 'primary' ] ]
parse("Kanye West vs. Daft Punk - Stronger").artists.map((a) => a.name);
// [ 'Kanye West', 'Daft Punk' ]

Some things look like joiners and aren't:

  • An unspaced /, & or + never splits. AC/DC and Drum&Bass stay whole.
  • x only splits in lowercase, so Malcolm X keeps its X.
  • & Sons, & Co., & His Orchestra and a few others never start a new artist. The list is in no-split-before.json.
  • A comma between two digits (1,000) is part of the name.

The rules for the artist side are R7 in the spec, and the splitting itself is R7.3. Open the first example in the playground to see every joiner.

and is common inside band names, so by default it only splits after a comma or semicolon has already split the same list:

parse("Simon and Garfunkel - The Boxer").artists.map((a) => a.name);
// [ 'Simon and Garfunkel' ]
parseArtists("Crosby, Stills, Nash and Young").map((a) => a.name);
// [ 'Crosby', 'Stills', 'Nash', 'Young' ]

Set splitAnd (split_and in Python and Rust, SplitAnd in Go, trackparse_parse_options_set_split_and in C) to "always" or "never" to change that (try it):

parse("Simon and Garfunkel - The Boxer", { splitAnd: "always" }).artists.map((a) => a.name);
// [ 'Simon', 'Garfunkel' ]
parseArtists("Crosby, Stills, Nash and Young", { splitAnd: "never" }).map((a) => a.name);
// [ 'Crosby', 'Stills', 'Nash and Young' ]

feat., ft. and featuring work on either side of the dash and in brackets. with and w/ only count at the start of a bracket, since "with" turns up in plenty of titles. All of these give the second name the role featured. In a bracket the rule is R5.2, left of the dash R7.2 and right of it R8.3:

parse("Noisia feat. Foreign Beggars - Shellshock").artists[1];
// { name: 'Foreign Beggars', role: 'featured', joiner: 'feat.', source: 'artist' }
parse("Noisia - Shellshock ft. Foreign Beggars").artists[1];
// { name: 'Foreign Beggars', role: 'featured', joiner: 'ft.', source: 'title' }
parse("Silk City - Electricity (with Dua Lipa)").artists[1];
// { name: 'Dua Lipa', role: 'featured', joiner: 'with', source: 'title' }

If the same person is credited twice, they appear once:

parse("Noisia feat. Foreign Beggars - Shellshock (feat. Foreign Beggars)").artists.map((a) => a.name);
// [ 'Noisia', 'Foreign Beggars' ]

Names are compared with full Unicode lowercasing and accents removed, so Sigur Rós and SIGUR ROS count as the same artist (R9.2). Try the example in the playground.

prod., prod. by and produced by credit a producer, in brackets (R5.3) or after the title (R8.3). The producer gets the role producer and leaves the title:

const t = parse("Future - Mask Off (prod. by Metro Boomin)");
t.artists[1]; // { name: 'Metro Boomin', role: 'producer', joiner: 'prod. by', source: 'title' }
t.title; // 'Mask Off'

(Python and Rust: known_artists; Go: KnownArtists; C: trackparse_parse_options_add_known_artist)

trackparse has no artist database, on purpose. A built-in list would be wrong for half its users and out of date within a month. You tell it the names you care about:

parse("Chase & Status - Baddadan").artists.map((a) => a.name);
// [ 'Chase', 'Status' ]
parse("Chase & Status - Baddadan", { knownArtists: ["Chase & Status"] }).artists.map((a) => a.name);
// [ 'Chase & Status' ]

A known name is matched case- and accent-insensitively wherever a name starts in a credit list. It also protects names that begin with digits from being read as a track number (3 Doors Down). If you parse a lot of strings with the same names, put them in createParser (create_parser in Python, Parser::new in Rust, NewParser in Go, trackparse_parser_new in C). You can try it in the playground. The option is listed under Options, and the matching rule is R7.3 (a).

ID (and Unknown, Untitled, ?, ???) means the track hasn't been announced yet. It doesn't become a name. The track gets flags.unknownArtist: true (flags.unknown_artist in Python and Rust, Flags.UnknownArtist in Go, flags.unknown_artist in C) instead, and the same goes for titles (R7.5, R8.6; open it in the playground):

const t = parse("ID - ID (ID Remix)");
t.artists; // []
t.flags.unknownArtist; // true
t.flags.unknownTitle; // true
t.versions[0].unknownArtist; // true