Datasets:
i int64 0 1.53k | source class label 1
class | caption stringlengths 98 285 | key_tok stringclasses 24
values | midi_name stringlengths 38 41 | midi unknown | chordstream listlengths 0 648 | cs_tokens int32 0 648 | cs_bars int32 0 463 | cs_key stringclasses 25
values | cs_error stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|
1,041 | 1midicaps_prose | A happy Christmas pop tune led by a repeating piano melody over strings and drums, with dramatic dynamic swings around the middle. | A major | 1041-19467429f65ea2a94a9f1d1cce8e7cc6.mid | [
77,
84,
104,
100,
0,
0,
0,
6,
0,
1,
0,
22,
0,
120,
77,
84,
114,
107,
0,
0,
1,
101,
0,
255,
3,
20,
67,
97,
114,
112,
101,
110,
116,
101,
114,
115,
45,
83,
117,
112,
101,
114,
115,
116,
97,
114,
0,
255,
3,
33,
104,
1... | [
576460752303424000,
576460760904140800,
288230393331618050,
72057615520401420,
217298703499694200,
288230401921814700,
144115218148004200,
146367017961689380,
144115222435629100,
146367022249314560,
864691167109875700,
288230427698696300,
288230431986323700,
288230436285485060,
288230440... | 103 | 85 | Gbm | |
434 | 1midicaps_prose | Acoustic guitar and drums carry a melodic classical pop tune with piano, strings and clarinet, swinging wide between soft and loud as it grows fuller late on, a christmas carol at heart. | D# major | 434-1a9ac085056cc265e1d85eb8a942d361.mid | [
77,
84,
104,
100,
0,
0,
0,
6,
0,
1,
0,
11,
0,
120,
77,
84,
114,
107,
0,
0,
1,
106,
0,
255,
88,
4,
4,
2,
24,
8,
0,
255,
89,
2,
0,
0,
0,
255,
81,
3,
14,
78,
28,
0,
255,
6,
61,
73,
32,
75,
110,
111,
119,
32,
72,... | [
288230376159613200,
72057598340273150,
145241092278227170,
75435298060801020,
144115196673167580,
74309402441584700,
291608084462735600,
75435306650735620,
144115205255762140,
146367005069709380,
216172803588657380,
75435315233329220,
288230401921550460,
288230406216519700,
1441152224356... | 99 | 69 | Eb | |
542 | 1midicaps_prose | A relaxing, melodic pop track led by pizzicato strings and acoustic guitar over drums, swelling dynamically to a busy midpoint. | A minor | 542-1591a0eb4ddedc05a8b377efd9798b9e.mid | [
77,
84,
104,
100,
0,
0,
0,
6,
0,
1,
0,
13,
1,
224,
77,
84,
114,
107,
0,
0,
0,
154,
0,
255,
3,
12,
34,
83,
117,
109,
109,
101,
114,
116,
105,
109,
101,
34,
0,
255,
3,
19,
102,
114,
111,
109,
32,
34,
80,
111,
114,
10... | [
216172782113784320,
75435293758456290,
144115192382918800,
146366992184543260,
144115196665825470,
146366996479512830,
144115200960792600,
146367000774478000,
144115205255759900,
146367005069447420,
144115209550727200,
146367009364447600,
144115213853036670,
146367013659625800,
144115218... | 111 | 56 | Am | |
569 | 1midicaps_prose | "An inspiring electronic track led by repetitive high strings over a punchy drum beat and double bas(...TRUNCATED) | C minor | 569-1aae163c6bdf49365298dd2d59ed3904.mid | "TVRoZAAAAAYAAQARAMBNVHJrAAAAQAD/AwVORVZFUgD/ASBHZW5lcmF0ZWQgYnkgTm90ZVdvcnRoeSBDb21wb3NlcgD/UQMH5Hk(...TRUNCATED) | [72057594037928416,505529058172375040,288230384741687520,288230389036781728,144115205255760160,14636(...TRUNCATED) | 125 | 111 | C | |
635 | 1midicaps_prose | "Drums and electric guitar anchor a corporate pop tune with piano, organ and choir that swells from (...TRUNCATED) | D minor | 635-14561224804ab0d7c74add16ca8b1c3a.mid | "TVRoZAAAAAYAAAABAeBNVHJrAADnqAD/AwhXQURERUhBRAD/WAQEAhgIAP9RAwehIAD/BRNBbGwgcmlnaHRzIHJlc2VydmVkAP8(...TRUNCATED) | [288230376151712242,576460756598425618,216172795000820786,75435306643398994,216172799295788178,75435(...TRUNCATED) | 167 | 88 | Dm | |
1,331 | 1midicaps_prose | "Two oboes and a violin carry a film classical idea that twists and turns, sparse at first and growi(...TRUNCATED) | C major | 1331-15de338479659ae317f0771efc624811.mid | "TVRoZAAAAAYAAQAPAPBNVHJrAAABAAD/WAQEAgwIAP9RAw0UNwD/BglBIFNlY3Rpb27+eP9RAw9CQEj/UQMNFDfvYP9RAw8CN2D(...TRUNCATED) | [216172782113784288,75435293758456256,288230380446846976,72057602638645312,73183502534986080,1463669(...TRUNCATED) | 648 | 229 | C | |
507 | 1midicaps_prose | "A happy electronic groove led by piano, bass and punchy drums, repeating a melodic theme before bra(...TRUNCATED) | D minor | 507-1ababca23815856962e05c9ece658eb4.mid | "TVRoZAAAAAYAAQARAHhNVHJrAAAAigD/Awh1bnRpdGxlZAD/VAVgAAMAAAD/WAQEAhgIAP9ZAgAAAP9RAwehIAD/BgdTbyBOaWN(...TRUNCATED) | [72057594038094066,145241087982698962,75435293765027986,216172786409048242,75435298053589042,7205760(...TRUNCATED) | 340 | 130 | Dm | |
1,340 | 1midicaps_prose | "An energetic, happy pop tune on solo piano with expressive single-note lines and wide dynamic swing(...TRUNCATED) | F major | 1340-16536d170ea88e942937ea08097e2ff8.mid | "TVRoZAAAAAYAAQAMAeBNVHJrAAAAIgD/WQIBAAD/VAVgAAAAAAD/UQMJJ8AA/1gEBAIYCAD/LwBNVHJrAABYDAD/IQEAAP8DCVJ(...TRUNCATED) | [144115188075856352,74309393851647200,75435293760588928,72057598340796416,73183498239775968,74309398(...TRUNCATED) | 306 | 106 | C | |
1,351 | 1midicaps_prose | "A happy Christmas pop tune driven by low drums, acoustic guitar and cello playing looped chords tha(...TRUNCATED) | D major | 1351-198dbac3f8f8c32e5c360eb9353fc65d.mid | "TVRoZAAAAAYAAQAMAHhNVHJrAAABEwD/AytUaW55IEJ1YmJsZXMsIFdvcmRzIGFuZCBNdXNpYyBieSBMZW9uIFBvYmVyAP8DElJ(...TRUNCATED) | [792633534417207778,75435302348390850,504403171157250050,75435310938624226,504403179748233218,754353(...TRUNCATED) | 68 | 70 | D | |
1,265 | 1midicaps_prose | "A relaxing electronic track led by prominent drums, electric piano and high flute, shifting through(...TRUNCATED) | G major | 1265-1faee94541c50e748b5104a1fe381752.mid | "TVRoZAAAAAYAAAABAGBNVHJrAAB1UwD/AwhEUkMwMDEgIAD/WAQEAhgIAP9RAw8CNoMAsXkAALEwAACxAAAAsSAAAMEaALJiYwC(...TRUNCATED) | [432345564227568103,146366992184543463,288230384741683207,288230389036910887,288230393331617799,2882(...TRUNCATED) | 86 | 56 | G |
Captioned MIDI with ChordStream
1,000 captioned MIDI files, each with its harmony extracted as a ChordStream token sequence: one 64-bit token per chord change or silence, carrying the key, the chord's degree in that key, its pitch-class content, its bass, and its absolute bar, onset and length in musical time.
Rows are the first 1,000 midicaps_prose rows of PsiPi/captioned-midi-moods-and-genre
(a private dataset), with the ChordStream column computed from each row's own midi bytes.
Splits
| split | rows |
|---|---|
| train | 900 |
| test | 100 |
Split 90/10 with train_test_split(test_size=0.1, seed=0).
Columns
| column | meaning |
|---|---|
i |
row id in the source dataset |
source |
always midicaps_prose here |
caption |
the prose caption |
key_tok |
key as labelled in the source dataset |
midi_name |
{i}-{original file name}.mid |
midi |
the MIDI file's bytes |
chordstream |
the ChordStream tokens, uint64 per token |
cs_tokens |
number of tokens |
cs_bars |
bars covered |
cs_key |
key at the start of the piece, e.g. C, Am; the key can change, and each token carries its own |
cs_error |
empty, or why extraction produced nothing |
Every token's top bit is zero, so the column is equally safe read as uint64 or int64.
That is deliberate: numpy promotes uint64 above 2^63-1 to float64 whenever it meets a
signed type, and Arrow refuses such values outright.
ChordStream token layout
A token is two 32-bit words: word_a = token & 0xFFFFFFFF, word_b = token >> 32.
Word A (chord)
| bits | field | meaning |
|---|---|---|
| 0-3 | tonic | key tonic pitch class 0-11 |
| 4 | mode | 0 major, 1 minor |
| 5-8 | degree | chord root relative to the tonic 0-11; 14 = solo line, 15 = silence |
| 9-19 | mask | bit i-1 set means the interval i semitones above the root is present |
| 20-23 | bass | bass pitch class relative to the chord root |
| 24-31 | reserved | zero |
Word B (time)
| bits | field | meaning |
|---|---|---|
| 0-15 | bar | absolute bar from the start of the piece |
| 16-21 | onset | sixteenths after the bar's downbeat |
| 22-29 | dur | length in sixteenths (1-255) |
| 30 | cont | 1 = continuation of the previous token (a chord that began earlier) |
| 31 | reserved | zero (the token's top bit) |
The absolute chord root is (tonic + degree) mod 12. Everything except the tonic is
relative to the key, so transposing a piece changes only the tonic. Time is in sixteenths
derived from ticks, never from tempo, so playback speed cannot change a token. Every token
carries its own bar, onset and key, so any contiguous slice is self-describing: a window
whose first token has bar > 0 began mid-piece, and its cont flag says whether its
chord started earlier.
Reading it
from datasets import load_dataset
PC = ["C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B"]
ROMAN = ["I", "bII", "II", "bIII", "III", "IV", "bV", "V", "bVI", "VI", "bVII", "VII"]
ds = load_dataset("PsiPi/captioned-ChordStream", split="train")
row = ds[0]
for tok in row["chordstream"]:
a, b = tok & 0xFFFFFFFF, tok >> 32
tonic, mode = a & 15, a >> 4 & 1
degree, mask, bass = a >> 5 & 15, a >> 9 & 0x7FF, a >> 20 & 15
bar, onset, dur, cont = b & 0xFFFF, b >> 16 & 63, b >> 22 & 255, b >> 30 & 1
if degree == 15:
name = "N.C." # silence
elif degree == 14:
name = "solo" # a single line, no harmony to name
else:
root = (tonic + degree) % 12
minorish = mask >> 2 & 1 and not mask >> 3 & 1 # minor third, no major third
numeral = ROMAN[degree].lower() if minorish else ROMAN[degree]
intervals = [i for i in range(1, 12) if mask >> (i - 1) & 1]
name = f"{numeral} {PC[root]} intervals={intervals} bass=+{bass}"
print(f"bar {bar}.{onset} dur {dur}{' cont' if cont else ''} "
f"key {PC[tonic]}{'m' if mode else ''} {name}")
How the harmony was extracted
Per chord step (the metre's beat, grouped to at least a quarter note), a duration-weighted pitch-class histogram is matched against 16 chord templates, with melody voices downweighted, pedal points removed and refitted, unaccompanied single lines marked as solo, passing chords absorbed and consecutive same-root steps merged. The key comes from Aarden-Essen profiles over a sliding 8-bar window with hysteresis. The full procedure, with every threshold, is in the ChordStream write-up (see Citation and further reading).
Known limitations
- The extractor is heuristic and has not been validated against human harmonic annotation. Chord quality is the noisy part: power chords, add9 and sus2 are over-produced where melody notes leak into the chord. Roots and cadences are more reliable.
- Only major and minor keys are modelled.
- 3 of the 1,000 rows produced no tokens (
cs_errorisno pitched notes: the file has drums only or no notes the extractor uses). They are kept, with empty token lists, so rows stay aligned with the source dataset. - Expressive performances (a recorded performance with a dense tempo map rather than a quantised score) have nominal bar lines, so chord steps placed on them may not match the harmonic rhythm a listener hears. This has not been measured.
Licence and provenance
The MIDI files come from the midicaps_prose portion of the parent dataset, which is
MidiCaps over the Lakh MIDI dataset:
CC BY-SA 4.0.
The captions are not MidiCaps captions. They were written for this project by PsiPi, generated with Anthropic models at PsiPi's own expense, and are licensed CC BY-SA 4.0.
The ChordStream column is derived from the MIDI files in the same rows.
Citation and further reading
The ChordStream format, its extraction procedure and its measured limitations are described in the accompanying write-up: https://huggingface.co/blog/PsiPi/chordstream-a-key-relative-time-anchored-chord-tok
- Downloads last month
- 33