Skip to content

Visualize repetitive structure encoded in a linear string of characters.

Notifications You must be signed in to change notification settings

j-brent/arc-diagrams

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arc-diagrams

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.

An arc diagram of the melody of the song Fuer Elise, by Ludwig van Beethoven

An arc diagram of the melody of the song Bolero, by Maurice Ravel

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.

Requirements

matplotlib

mido (optional: only required if you want to plot arc diagrams created from midi files)

Getting Started

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.

References

Arc Diagrams: Visualizing Structures in Strings

The Shape of Song (2001)

The Shape of Song (official website)

I discovered these diagrams while perusing the book Processing: A Programming Handbook for Visual Designers and Artists

About

Visualize repetitive structure encoded in a linear string of characters.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages