This project is an attempt to implement the Arc Diagrams designed by Martin Wattenberg and used in his project The Shape of Song.
Broadly speaking, the aim of an arc diagram is to visualize patterns in strings by finding matching substrings and connecting them with a transluscent arc. The overlapping arcs of various thickeness and radius help to visualize structure and patterns embedded within the string. Arc diagrams can be applied to any string of characters. The following examples show arc diagrams generated by the code in this repository from strings generated from midi music files of Bolero by Maurice Ravel, and Für Elise by Ludwig van Beethoven.
Caveat: The algorithms in this repository are not an implementation of the algorithm developed and described by Martin Wattenberg in his article Arc Diagrams: Visualizing Structures in Strings, but merely a first order approximation that I implemented from seeing his diagrams and reading his simplified description. I thought that the results were visually interesting enough to share here, and I provide links to the original sources for those who want to explore the ideas further, and to give credit to the original creator of these ideas.
mido (optional: only required if you want to plot arc diagrams created from midi files)
To generate arc diagrams from your own strings, simply include the files arc_diagram.py and substring.py in your project and call
plot_arc_diagram(string)
to generate an arc diagram as a matplotlib figure.
You can also generate the examples by calling
python arc-diagram-midi.py
if you have installed the optional python module mido.
Arc Diagrams: Visualizing Structures in Strings
The Shape of Song (official website)
I discovered these diagrams while perusing the book Processing: A Programming Handbook for Visual Designers and Artists