liveBook · Manning

Musical event

As explained in Learn Generative AI with PyTorch

A token-like symbolic unit representing a note or control information in a music sequence used for model training and generation.

A musical event is a token-like unit that represents a note action or timing information in a performance-based music sequence. Converting music into these events lets a GPT-style Transformer predict the next event from everything that came before it. section 14.1 section 14.0

Reduce performance data to four event types:

  • Note-on marks the start of a note and specifies its pitch. section 14.1
  • Note-off marks the end of a note. section 14.1
  • Time-shift records the elapsed time between two musical events. section 14.1
  • Velocity records how forcefully or loudly a note is played. section 14.1

Each event type can take multiple values. Assign every unique event a distinct index, turning a performance into a sequence of indexes rather than the multidimensional representation used by an image-like music model. section 14.1 section 14.5

From performance to generation

A music sequence becomes an ordered stream of note-on, velocity, time-shift, and note-off events, then an indexed token sequence. A decoder-only music Transformer learns patterns and relationships in such sequences and predicts the next musical event; generated events can be converted back into a playable MIDI file. section 14.0 section 14.5

How Learn Generative AI with PyTorch covers it

How deep it goes
Defines four event types, explains their roles and indexing, then applies them to Transformer training and generation.
Examples
Uses note-on, note-off, time-shift, and velocity events as the representation, then converts generated sequences into playable MIDI.
What it assumes
Assumes sequence-modeling ideas from NLP while teaching performance-based representation and event indexing explicitly.
What you can do after
Build a tokenized music sequence and use a trained Transformer to generate further musical events.
How it connects
Connects performance-based music representation with MIDI, tokenization, Transformers, self-attention, and sequence 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.