Like language, music can be represented as a sequence of discrete symbols that form a hierarchical syntax, with notes being roughly like characters and motifs of notes like words.   Unlike text however, music relies heavily on repetition on multiple timescales to build structure and meaning. The Music Transformer has shown compelling results in generating music with structure (Huang et al., 2018).   In this paper, we introduce a tool for visualizing self-attention on polyphonic music with an interactive pianoroll.   We use music transformer as both a descriptive tool and a generative model.   For the former, we use it to analyze existing music to see if the resulting self-attention structure corroborates with the musical structure known from music theory.   For the latter, we inspect the model's self-attention during generation, in order to understand how past notes affect future ones. We also compare and contrast the attention structure of regular attention to that of relative attention (Shaw et al., 2018, Huang et al., 2018), and examine its impact on the resulting generated music.   For example, for the JSB Chorales dataset, a model trained with relative attention is more consistent in attending to all the voices in the preceding timestep and the chords before, and at cadences to the beginning of a phrase, allowing it to create an arc.   We hope that our analyses will offer more evidence for relative self-attention as a powerful inductive bias for modeling music.   We invite the reader to explore our video animations of music attention and to interact with the visualizations at https://storage.googleapis.com/nips-workshop-visualization/index.html.
Visualizing the differences between regular and relative attention for Music Transformer.