Keyscapes
https://bit.ly/music254-keyscapes
Craig Sapp
4 April 2024
Music 254 / CS 275b
Stanford University
Key Identification
Computational Key Identification
Pearson correlation:
Krumhansl-Schmuckler
key-finding algorithm:
(normalized dot product)
“The key is the case where the correlation is highest when comparing the measured pitch histogram with the key prototypes”
Computational Key Identification
Computational Key Identification
KS algorithm:
DFT:
dot product
“Key spectrum”: key is highest peak
“z-scores”
Prototype weights
Scape Plotting Domain
original
sequence:
← time axis →
start
end
← analysis window size →
small
large
“multi time resolution key spectrogram”
Problem: musical keys are not static in a composition
Scape Plotting Domain
Showing all segmentations of music
Beethoven Piano Sonata #5 mvmt 1
C minor
Eb major
Sonata No. 5 Internal Key Structure
Theme 1 (C minor):
Theme 2
(Eb major):
Theme 2 (recap):
Theme 2 (F major):
Other C-Minor Beethoven Sonatas
No. 5:
Beethoven sonatas
Sonata form
Rondo form
Chopin mazurkas
More Keyscapes
J.N. Hummel
Variability in key profile behaviors
Chopin prelude 28/1
Evaluating prototype weights
Twelvetone music (Webern op 27/1)
Petrus de Cruce (1200’s)
twelvetone
Antitonality
Weak tonality
Showing best match
Clarity plot (modulation boundaries)
Post-processing
Key boundaries
Removing unlikely key analyses
Filling in invalidated with secondary adjacent keys
Trimming regions
Tunneling
Interpreted
mkeyscape
http://extras.humdrum.org/man/mkeyscape
Using mkeyscape in the terminal
mkeyscape -nl --trim \
h://beethoven/sonatas/sonata01-1.krn \
| convert - sonata01-1.png
open sonata01-1.png
In MacOS, “open” is similar to double-clicking on file in Finder:
Keyscapes in VHV
POPC2 website
Implementation notes
P3
4 4
255
0 0 0 0 0 64 0 224 128 0 0 191
64 0 0 64 0 64 64 0 128 64 0 191
128 0 0 128 0 64 128 0 128 128 0 191
191 0 0 191 0 64 191 0 128 191 0 191
columns rows
levels per pixel (-1)
ASCII PPM image:
https://en.wikipedia.org/wiki/Netpbm
imagedemo -x 400 -y 200 > image.ppm