Harmonic entropy: Difference between revisions

m Style improvments +1. +links
ArrowHead294 (talk | contribs)
m update shortcut to something easier to type
 
(13 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Legacy}}
'''Harmonic entropy''' ('''HE''') is a simple model to quantify the extent to which musical [[chord]]s align with the [[harmonic series]], and thus tend to partly "fuse" into the perception of a single sound with a complex timbre and [[virtual fundamental]] pitch.  
'''Harmonic entropy''' ('''HE''') is a simple model to quantify the extent to which musical [[chord]]s align with the [[harmonic series]], and thus tend to partly "fuse" into the perception of a single sound with a complex timbre and [[virtual fundamental]] pitch. It was invented by [[Paul Erlich]] and developed extensively on the Yahoo! tuning and harmonic_entropy lists, and draws from prior research by Parncutt and Terhardt. Various later contributions to the model have been made by [[Steve Martin]], [[Mike Battaglia]], [[Keenan Pepper]], and others.
 
A simple way to state this, is: harmonic entropy measures degree of certainty in the perception of the (virtual) [[root]].
 
Harmonic entropy was invented by [[Paul Erlich]] and developed extensively on the Yahoo! tuning and harmonic_entropy lists, and draws from prior research by Parncutt and Terhardt. Various later contributions to the model have been made by [[Steve Martin]], [[Mike Battaglia]], [[Keenan Pepper]], and others.
 
An interactive harmonic entropy graph can be found in [[Scale Workshop]] version 3 in the Analysis tab.


Note: the terms dyad, triad and tetrad usually refer to chord with 2, 3, or 4 [[pitch class]]es. But in this discussion they refer to chords with 2, 3, or 4 ''pitches''. Thus {{dash|C, E, G, C}} is a tetrad instead of a triad.
Note: the terms dyad, triad and tetrad usually refer to chord with 2, 3, or 4 [[pitch class]]es. But in this discussion they refer to chords with 2, 3, or 4 ''pitches''. Thus {{dash|C, E, G, C}} is a tetrad instead of a triad.
Line 285: Line 290:
We note that the left factor in the convolution product is always the same ''S''(−''c''), which is not dependent on ''j'' in any way. Since convolution distributes over addition, we can factor the ''S'' out of the summation to obtain
We note that the left factor in the convolution product is always the same ''S''(−''c''), which is not dependent on ''j'' in any way. Since convolution distributes over addition, we can factor the ''S'' out of the summation to obtain


$$\displaystyle \psi(c) = \left[S \ast \left(\sum_{j \in J} \frac{\delta_{-\cent(j)}}{\|j\|}\right)\right](-c)$$
<nowiki>$$\displaystyle \psi(c) = \left[S \ast \left(\sum_{j \in J} \frac{\delta_{-\cent(j)}}{\|j\|}\right)\right](-c)$$</nowiki>
 




We can clean up this notation by defining the auxiliary distribution ''K'':
We can clean up this notation by defining the auxiliary distribution ''K'':


$$\displaystyle K(c) = \sum_{j \in J} \frac{\delta_{-\cent(j)}}{\|j\|}$$
<nowiki>$$\displaystyle K(c) = \sum_{j \in J} \frac{\delta_{-\cent(j)}}{\|j\|}$$</nowiki>
 




Line 296: Line 303:


$$\displaystyle \psi(c) = \left[S \ast K\right](-c)$$
$$\displaystyle \psi(c) = \left[S \ast K\right](-c)$$
If we discretize this to an integer array of cents, give S a standard deviation of 17 cents, and represent all delta functions in K as a vertical line of height 1, we can visualize S and K like so:
[[File:S function.png|alt=S function with a standard deviation of 17 cents|frameless]][[File:K function.png|alt=Visualization of K(c) on 1201 samples for intervals of up to numerator/denominator of 200|frameless]]


==== Convolution product for ρ<sub>a</sub>(''c'') ====
==== Convolution product for ρ<sub>a</sub>(''c'') ====
Line 345: Line 358:


We have succeeded in representing harmonic Rényi entropy in simple terms of two convolution products, each of which can be computed in {{nowrap|''O''(''N'' log ''N'')}} time.
We have succeeded in representing harmonic Rényi entropy in simple terms of two convolution products, each of which can be computed in {{nowrap|''O''(''N'' log ''N'')}} time.
==== Python Example ====
<syntaxhighlight lang="python3" line="1">
import numpy as np
def gaussian(x, stdev):
    return 1.0 / (stdev * np.sqrt(2.0 * np.pi)) * np.exp( -0.5 * (x**2) / (stdev**2) )
x = np.array(range(1201))
intervals = []
interval_weights = []
for i in range(1, 200):
    for j in range(1, 200):
        if np.gcd(i,j) == 1 and 1.0 * i / j >= 1.0 and 1.0 * i / j <= 2.0:
            intervals.append(1.0 * i / j)
            interval_weights.append(np.sqrt(i * j))
intervals = np.array(intervals)
interval_weights = np.array(interval_weights)
intervals_cents = 1200 * np.log2(intervals)
K = np.zeros(len(x))
for i in range(len(intervals)):
    closest_cent = np.rint(intervals_cents[i]).astype(int) # change this if x has non integers
    if K[closest_cent] == 0.0 or K[closest_cent] < 1.0 / interval_weights[i]:
        K[closest_cent] = 1.0 / interval_weights[i]
x_gaussian = range(100)
gaussian_deviation_cents = 17
S = np.array([gaussian(x-50, gaussian_deviation_cents) for x in x_gaussian])
a = 100
reyni_entropy = 1.0 / (1.0 - a) * np.log( np.convolve(K**a, S**a, 'same') / np.convolve(K, S, 'same')**a )
</syntaxhighlight>


== Extending HE to ''N'' {{=}} ∞: zeta-HE ==
== Extending HE to ''N'' {{=}} ∞: zeta-HE ==
Line 757: Line 805:
$$\displaystyle \mathcal{F}\left\{K(n)\right\}(t) = \sum_{j \in J} \frac{e^{i  t \log (j_n/j_d)}}{(j_n \cdot j_d)^{w}}$$
$$\displaystyle \mathcal{F}\left\{K(n)\right\}(t) = \sum_{j \in J} \frac{e^{i  t \log (j_n/j_d)}}{(j_n \cdot j_d)^{w}}$$


Now, suppose we want to analytically continue this so that the set ''J'' is the set of all reduced rational numbers. We can first do so by starting again with unreduced rationals, but expressing each rational not as {{sfrac|''n''|''d''}}, but rather as {{nowrap|{{sfrac|''n''{{'}}|''d''{{-'}}}} · {{sfrac|''c''|''c''}}}}, where ''n''{{'}} and ''d''{{-'}} are coprime, and ''c'' is the gcd of both. For example, we would express {{sfrac|6|4}} as {{nowrap|{{sfrac|3|2}} · {{sfrac|2|2}}}}. Doing so, and assuming that we denote the set of unreduced rationals by ''U'', we get the following equivalent expression of the same convolution kernel above:
Now, suppose we want to analytically continue this so that the set ''J'' is the set of all reduced rational numbers. We can first do so by starting again with unreduced rationals, but expressing each rational not as {{sfrac|''n''|''d''}}, but rather as {{nowrap|{{sfrac|''n''{{``}}|''d''{{-`}}}} · {{sfrac|''c''|''c''}}}}, where ''n''{{``}} and ''d''{{-`}} are coprime, and ''c'' is the GCD of both. For example, we would express {{sfrac|6|4}} as {{nowrap|{{sfrac|3|2}} · {{sfrac|2|2}}}}. Doing so, and assuming that we denote the set of unreduced rationals by ''U'', we get the following equivalent expression of the same convolution kernel above:


$$\displaystyle \mathcal{F}\left\{K(n)\right\}(t) = \sum_{j \in \mathbb{U}} \frac{e^{i  t \log (\frac{j_c j_{n'}}{j_c j_{d'}})}}{(j_c j_{n'} \cdot j_c j_{d'})^{w}} = |\zeta(w+i t)|^2$$
$$\displaystyle \mathcal{F}\left\{K(n)\right\}(t) = \sum_{j \in \mathbb{U}} \frac{e^{i  t \log (\frac{j_c j_{n'}}{j_c j_{d'}})}}{(j_c j_{n'} \cdot j_c j_{d'})^{w}} = |\zeta(w+i t)|^2$$
Line 771: Line 819:
$$\displaystyle |\zeta(w+i t)|^2 = \left[ \sum_{j_c \in \mathbb{N}^+} \frac{1}{{j_c}^{2w}} \right] \cdot \left[ \sum_{j \in \mathbb{Q}} \frac{e^{i  t \log (\frac{j_{n'}}{j_{d'}})}}{(j_{n'} j_{d'})^{w}} \right]$$
$$\displaystyle |\zeta(w+i t)|^2 = \left[ \sum_{j_c \in \mathbb{N}^+} \frac{1}{{j_c}^{2w}} \right] \cdot \left[ \sum_{j \in \mathbb{Q}} \frac{e^{i  t \log (\frac{j_{n'}}{j_{d'}})}}{(j_{n'} j_{d'})^{w}} \right]$$


where the left summation now has {{nowrap|''j''<sub>''c''</sub> ∈ ℕ{{mpp}}}}, the set of strictly positive rational numbers, and the right summation now has {{nowrap|''j'' ∈ ℚ}} the set of reduced rationals. Note again that the product above yields all unreduced rationals, thanks to the ''j''<sub>''c''</sub>.
where the left summation now has {{nowrap|''j''<sub>''c''</sub> ∈ ℕ{{+}}}}, the set of strictly positive rational numbers, and the right summation now has {{nowrap|''j'' ∈ ℚ}} the set of reduced rationals. Note again that the product above yields all unreduced rationals, thanks to the ''j''<sub>''c''</sub>.


Now, note that that left series is, itself, just another Dirichlet series that converges to the zeta function. We have
Now, note that that left series is, itself, just another Dirichlet series that converges to the zeta function. We have
Line 788: Line 836:


Lastly, you will note that for the special value {{nowrap|''w'' {{=}} 0.5}}, corresponding to the usual <math>\sqrt{nd}</math> weighting, we end up dividing by the term ζ(1). This is the only pole in the zeta function, so we wind up dividing by infinity, making the entire function zero, as pointed out by Martin Gough. However, as we can get arbitrarily close to {{nowrap|''w'' {{=}} 0.5}} and still exhibit the behavior that the unreduced and reduced functions are scaled versions of one another, we can simply use the unreduced version of exp-UHE for {{nowrap|''w'' {{=}} 0.5}} and consider it equivalent to reduced exp-UHE in the limit.
Lastly, you will note that for the special value {{nowrap|''w'' {{=}} 0.5}}, corresponding to the usual <math>\sqrt{nd}</math> weighting, we end up dividing by the term ζ(1). This is the only pole in the zeta function, so we wind up dividing by infinity, making the entire function zero, as pointed out by Martin Gough. However, as we can get arbitrarily close to {{nowrap|''w'' {{=}} 0.5}} and still exhibit the behavior that the unreduced and reduced functions are scaled versions of one another, we can simply use the unreduced version of exp-UHE for {{nowrap|''w'' {{=}} 0.5}} and consider it equivalent to reduced exp-UHE in the limit.
== Todo ==
There are a number of things that need to be added to this article. Below are listed some for reference:
* 3HE, both for finite HE and for {{nowrap|''N'' → ∞}}
* Write-up of fast computation for infinite zeta-UHE, perhaps with a zeta table
* Addition of many more pictures


== References ==
== References ==
Line 802: Line 843:
* [https://yahootuninggroupsultimatebackup.github.io/harmonic_entropy Harmonic entropy group on Yahoo] (archive)
* [https://yahootuninggroupsultimatebackup.github.io/harmonic_entropy Harmonic entropy group on Yahoo] (archive)
* [http://www.mikebattagliamusic.com/HE-JS/HE.html Harmonic entropy graph calculator (JavaScript)]
* [http://www.mikebattagliamusic.com/HE-JS/HE.html Harmonic entropy graph calculator (JavaScript)]
== See also ==
* [[Harmonic entropy of just intervals]]
* [[Low harmonic entropy linear temperaments]]
* [[User:Sintel/Validation of common consonance measures]] — an informal empirical study which calls into question the effectiveness of harmonic entropy for explaining [[consonance]]
== Todo ==
{{todo|inline=1|complete section|text=Add 3HE, both for finite HE and for ''N'' → ∞.}}
{{todo|inline=1|complete section|add table|text=Write-up of fast computation for infinite zeta-UHE, perhaps with a zeta table.}}
{{todo|inline=1|add illustration|text=Addition of many more pictures.}}


[[Category:Terms]]
[[Category:Terms]]