Periodicity, also known as harmonicity, is an important predictor of a chord’s consonance. This package implements Stolzenburg’s (2015) algorithm for quantifying a chord’s periodicity.
You can install this package from GitHub:
if (!require(devtools)) install.packages("devtools")
devtools::install_github("pmcharrison/stolz15")
Higher model outputs correspond to greater period lengths and hence lower periodicity. A major chord therefore produces a lower score than a diminished chord:
library(stolz15)
smooth_log_periodicity(c(60, 64, 67))
#> [1] 2
smooth_log_periodicity(c(60, 63, 66))
#> [1] 3.786034
Stolzenburg, F. (2015). Harmony perception by periodicity detection. Journal of Mathematics and Music, 9(3), 215–238. https://doi.org/10.1080/17459737.2015.1033024