liveBook · Manning

Musical measure

As explained in Learn Generative AI with PyTorch

A musical time unit that groups beats in a composition.

A musical measure, also called a bar, is a segment of time containing a specified number of beats. Its beat count and beat duration follow the piece’s time signature. Many popular styles use four beats per measure, but the count can vary. section 13.1.2

In digital music, a measure organizes several nested levels:

  • A track contains multiple measures and represents an individual musical layer, such as drums, bass, melody, or a vocal part. section 13.1.2
  • A measure is subdivided into steps for programming rhythm and melody. In 4/4 time with four steps per beat, one measure contains 16 steps. section 13.1.2
  • Each step can hold a note, allowing a measure to become a structured digital representation rather than only a notation concept. section 13.1.2

Two measures in a multitrack piece

A four-track piece can assign two measures to every track. With 16 steps per measure, its representation has shape (4, 2, 16, 84): four tracks, two measures, 16 steps per measure, and 84 possible notes per step. The measure dimension separates the first time segment from the second while preserving alignment across tracks. section 13.6 section 13.0

Figure 13.2 Staff notation for a piece of music in JSB Chorales dataset. The music has four tracks, representing the four voices in a chorale: soprano, alto, tenor, and bass. The notation is structured into two bars for each track, with the left and right halves representing the first and second bars, respectively. Each bar consists of 16 steps, aligning with the 4/4 time signature where a bar contains four beats, each subdivided into four sixteenth notes. A total of 84 different pitches are possible, and each note is represented as a one-hot vector with 84 values.

Inspect the staff notation showing four tracks, two aligned measures, and 16 steps within each measure. section 13.1.2

How Learn Generative AI with PyTorch covers it

How deep it goes
Defines beats, time signatures, steps, and tensor dimensions, but does not develop broader music-theory analysis.
Examples
Uses 4/4 measures with 16 steps, two-measure tracks, staff notation, and a (4, 2, 16, 84) music representation.
What you can do after
Build it from scratch as a time dimension for step-sequenced music and multidimensional music data.
How it connects
Connects measures with time signatures, beats, tracks, steps, notes, piano rolls, MIDI, and temporal networks.

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.