liveBook · Manning

Control message

As explained in Learn Generative AI with PyTorch

A MIDI event that conveys performance control information such as note on/off timing and related parameters.

A control message is a MIDI event that records performance actions such as starting or releasing a note. Note-on and note-off messages carry pitch values, while velocity is handled separately to represent playing dynamics. Together, these events preserve timing, pitch, articulation, and expressive force for playback or model training. section 14.1.1

A performance sequence reduces to four event types:

  • note_on starts a note at a pitch from 0 to 127; for example, 74 represents D5. section 14.1.1
  • velocity records dynamics separately, with original values from 0 to 127 reduced to 32 bins. section 14.1.1

From performance event to model input

A note-on event at approximately 1.03 seconds with pitch 74 and velocity 86 becomes a time-shift event, a binned velocity event, and a note-on event with value 74. The resulting event sequence can then be converted into indexes for a music Transformer. section 14.1.1

How Learn Generative AI with PyTorch covers it

How deep it goes
Defines event types, value ranges, timing increments, velocity binning, and conversion into model indexes.
Examples
Uses five timestamped performance notes, including pitches 74 and 38, plus a tokenized event sequence.
What it assumes
Assumes basic musical pitch knowledge while defining MIDI values, timing increments, velocity bins, and tokenization.
What you can do after
Apply it by converting performance notes into event tokens and indexes suitable for a music Transformer.
How it connects
Connects MIDI, velocity, note-on events, note-off events, time-shift events, tokenization, and music Transformers.

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.