har18: Implementation of Harrison & Pearce’s (2018) Harmonicity Model

lifecycle Travis build
status AppVeyor build
status Coverage
status DOI

Harmonicity is an important predictor of a chord’s consonance. This package provides methods for estimating a chord’s harmonicity, after Harrison & Pearce (2018) and Milne (2013).


You can install this package from GitHub:

if (!require(devtools)) install.packages("devtools")

Example usage

A major chord is more harmonic than a diminished chord, as expected:


pc_harmonicity("0 4 7")
#> [1] 0.9373149
pc_harmonicity("0 3 6")
#> [1] 0.7225033

By default, the package implements the method of Harrison & Pearce (2018). Setting the option method = "peak" reproduces the method of Milne (2013).

pc_harmonicity("0 4 7", method = "peak")
#> [1] 0.7170107
pc_harmonicity("0 3 6", method = "peak")
#> [1] 0.5896047


Harrison, P. M. C., & Pearce, M. T. (2018). An energy-based generative sequence model for testing sensory theories of Western harmony. In Proceedings of the 19th International Society for Music Information Retrieval Conference. Paris, France. Retrieved from

Milne, A. J. (2013). A computational model of the cognition of tonality. The Open University, Milton Keynes, England.

pmcharrison/har18 documentation built on May 25, 2019, 4:03 a.m.