The jl12
R package implements Johnson-Laird’s (2012) tonal dissonance
model.
Within R, you can install the current version of jl12
from Github as
follows:
if (!require(devtools)) install.packages("devtools")
devtools::install_github("jl12")
Higher scores correspond to greater dissonance. These scores correspond to each of the distinguishable categories in the cultural component of Johnson-Laird et al.’s (2012) algorithm.
Major chord:
library(jl12)
jl_tonal_dissonance(c(0, 4, 7))
#> [1] 1
Minor chord:
jl_tonal_dissonance(c(0, 3, 7))
#> [1] 3
Cluster chord:
jl_tonal_dissonance(c(0, 1, 2))
#> [1] 12
The model comprises several rules. It is possible to call these rules individually, for example:
jl_rule_1(c(0, 3, 7))
#> [1] 1
jl_rule_2(c(0, 3, 7))
#> [1] TRUE
jl_rule_3(c(0, 3, 7))
#> [1] FALSE
#> attr(,"solution")
#> [1] 0 3 7 10
Johnson-Laird, P. N., Kang, O. E., & Leong, Y. C. (2012). On musical dissonance. Music Perception, 30(1), 19–35.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.