Tutorial Basics Notes Part 1: Visualizations

(version 2022_01_03)

Table of contents:

  1. Piano roll display
  2. Visualisation of dynamics
  3. Piano score
  4. Piano score with chord position symbols and roman numerals
  5. Tasks

In this tutorial we will discuss possibilities for

  1. the visualization of note files and
  2. the automated creation of a piano score and a harmonic designation of a sheet music.

Both areas are presented with music examples andcertain analytical questions followed by an interpretation of the respective results. Working through and following the tutorial should enable you to examine your own music examples (sheet music files) as well as to make comparisons between different pieces of music.

Every seesion with a Jupyter notebook using the Python library music21 starts with the import of music21 - using this simple command:

To load a file from the internet, you only have to insert the internet address of the file with the following syntax (red marked URL). The URL can be taken from the sheet music database, e.g. https://analyse.hfm-weimar.de/doku.php?id=en:mowo (mouse right-click on the link: "Copy link address"). We now load the first movement of the String Quartet No. 1, D major, KV 80, by Wolfgang Amadeus Mozart.

You can also listen to the piece in the browser – but only in a version with MIDI sounds and when Firefox or Chrome is used as the browser.

1. Piano roll display

What can be seen by this way of display?

To zoom in, you can either select individual sections and bars (see 2.2), or you can activate the MatPlotlib add-on module, which opens a popup window.

Select the magnifying glass symbol in the pop-up window. If you now select a section with the mouse, the section will be enlarged. The section can then be moved using the cross symbol.

Note: Piano rolls can also be generated in the Sonic Visualiser. There, the corresponding note files can be listened to simultaneously while the piano roll runs from right to left. See: https://analyse.hfm-weimar.de/doku.php?id=sv-pianoroll.

2. Visualization of dynamics

If dynamic are marked in the score file (pp, p, mf, f, ff, etc.), they can be integrated into a visual representation of the parts using the following code. Since this is not the case in the Mozart String Quartet, we load the Ballade in B minor Franz Liszt for this purpose:

This representation allows you to follow the dynamics of the ballad quite nicely, including rests. Since the dynamic symbols are linked to the staff of the right hand, but refer to the entire sheet music, the left hand is only displayed as a vertical bar. By adding the command '%matplotlib' the graphic can be opened externally

For use in other computer applications (Word, Powerpoint) the graphics (as png file) can of course be exported:

3. Piano score

With the Chordify command you can easily create a piano score. Now, we come back to Mozart’s string quartet.