liveBook · Manning

JSB Chorales dataset

As explained in Learn Generative AI with PyTorch

A dataset of Bach chorales arranged as multitrack piano-roll music and used as training data for music generation models such as MuseGAN.

The JSB Chorales dataset contains Bach chorales arranged as four-track piano rolls for training music-generation models such as MuseGAN. Each track represents a vocal part—soprano, alto, tenor, or bass—and each song uses the shape (4, 2, 16, 84): four tracks, two bars, sixteen steps per bar, and 84 possible pitches per step. section 13.0 section 13.1.2

Its representation breaks each musical piece into:

Loading a training batch

Download Jsb16thSeparated.npz, create a MidiDataset, inspect the first song, and batch the data with a PyTorch DataLoader. The first song has shape torch.Size([4, 2, 16, 84]); a flattened value check returns {-1.0, 1.0}. section 13.3.1

How Learn Generative AI with PyTorch covers it

How deep it goes
Defines the piano-roll dimensions, pitch encoding, MIDI conversion, download, loading, and batching, but not dataset curation.
Examples
Uses a two-bar four-voice chorale, example.midi staff notation, and a PyTorch batch-loading example.
What it assumes
Explains tracks, bars, steps, pitches, and MIDI representation before using the dataset-loading code.
What you can do after
Apply it via MidiDataset and DataLoader to inspect songs and prepare batches for MuseGAN training.
How it connects
Connects piano rolls with multitrack music, MIDI, one-hot encoding, MuseGAN, and GAN-based music generation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Generative AI with PyTorch. The section links point to the parts of the book it draws on.