<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="https://ulysseszh.github.io/feed/music.xml" rel="self" type="application/atom+xml" /><link href="https://ulysseszh.github.io/" rel="alternate" type="text/html" hreflang="en-US" /><updated>2026-04-19T16:48:01-07:00</updated><id>https://ulysseszh.github.io/feed/music.xml</id><title type="html"><![CDATA[Ulysses’ trip | Music]]></title><subtitle>Here we are at the awesome (awful) blog written by UlyssesZhan!</subtitle><author><name>UlyssesZhan</name><email>ulysseszhan@gmail.com</email></author><entry><title type="html"><![CDATA[The buildup kickroll in <cite>Time to beat the odds</cite>]]></title><link href="https://ulysseszh.github.io/music/2025/06/22/beat-the-odds-kickroll.html" rel="alternate" type="text/html" title="The buildup kickroll in Time to beat the odds" /><published>2025-06-22T00:31:43-07:00</published><updated>2025-06-22T00:31:43-07:00</updated><id>https://ulysseszh.github.io/music/2025/06/22/beat-the-odds-kickroll</id><content type="html" xml:base="https://ulysseszh.github.io/music/2025/06/22/beat-the-odds-kickroll.html"><![CDATA[<details>
<summary>
Python preamble
</summary>
<p>Packages to install from PyPI: <code>numpy</code>, <code>scipy</code>, <code>matplotlib</code>, <code>soundfile</code>.</p>
<table class="rouge-table"><tbody><tr><td class="highlight language-python"><pre><code><span class="line line-1"><span class="kn">import</span> <span class="n">numpy</span> <span class="k">as</span> <span class="n">np</span>
</span><span class="line line-2"><span class="kn">from</span> <span class="n">scipy.signal</span> <span class="kn">import</span> <span class="n">ShortTimeFFT</span><span class="p">,</span> <span class="n">find_peaks</span>
</span><span class="line line-3"><span class="kn">from</span> <span class="n">scipy.signal.windows</span> <span class="kn">import</span> <span class="n">hann</span>
</span><span class="line line-4"><span class="kn">from</span> <span class="n">scipy.optimize</span> <span class="kn">import</span> <span class="n">fsolve</span>
</span><span class="line line-5"><span class="kn">from</span> <span class="n">scipy.stats</span> <span class="kn">import</span> <span class="n">linregress</span>
</span><span class="line line-6"><span class="kn">import</span> <span class="n">matplotlib.pyplot</span> <span class="k">as</span> <span class="n">plt</span>
</span><span class="line line-7"><span class="kn">from</span> <span class="n">matplotlib.colors</span> <span class="kn">import</span> <span class="n">LogNorm</span>
</span><span class="line line-8"><span class="kn">import</span> <span class="n">soundfile</span>
</span></code></pre></td></tr></tbody></table>
</details>
<p>There is a nice song by 影虎。called <cite>Time to beat the odds</cite>:</p>
<div class="embed-container">
<iframe src="https://www.youtube.com/embed/C-XxL_LUB18" frameborder="0" allowfullscreen="">
</iframe>
</div>
<p>At 1:18, there is an interesting buildup kickroll. This effect is created by mixing a steady 32nd note kickroll with a gradually-accelerating buildup kickroll. The gradually-accelerating part is not quantized to dyadic note values, so it is pretty hard to analyze by ear.</p>
<p>One can obtain a clearer sample of this kickroll by consulting the file <code>Dr_KICKroll00.ogg</code> from the <a href="https://bmssearch.net/bmses/Lay7qGChaJUgrs" target="_blank" rel="external">BMS</a>. The waveform of the sample looks like this:</p>
<details>
<summary>
Python code
</summary>
<table class="rouge-table"><tbody><tr><td class="highlight language-python"><pre><code><span class="line line-1"><span class="n">samples</span><span class="p">,</span> <span class="n">fs</span> <span class="o">=</span> <span class="n">soundfile</span><span class="p">.</span><span class="nf">read</span><span class="p">(</span><span class="sh">"</span><span class="s">Kagetora_Time-to-beat-the-odds_bofet/Dr_KICKroll00.ogg</span><span class="sh">"</span><span class="p">)</span>
</span><span class="line line-2"><span class="n">fs</span> <span class="o">/=</span> <span class="mi">1000</span> <span class="c1"># Use ms and kHz</span>
</span><span class="line line-3"><span class="k">if</span> <span class="n">samples</span><span class="p">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
</span><span class="line line-4">	<span class="n">samples</span> <span class="o">=</span> <span class="n">samples</span><span class="p">.</span><span class="nf">mean</span><span class="p">(</span><span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
</span><span class="line line-5"><span class="n">N</span> <span class="o">=</span> <span class="nf">len</span><span class="p">(</span><span class="n">samples</span><span class="p">)</span>
</span><span class="line line-6">
</span><span class="line line-7"><span class="n">plt</span><span class="p">.</span><span class="nf">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">6</span><span class="p">))</span>
</span><span class="line line-8"><span class="n">plt</span><span class="p">.</span><span class="nf">plot</span><span class="p">(</span><span class="n">np</span><span class="p">.</span><span class="nf">arange</span><span class="p">(</span><span class="n">N</span><span class="p">)</span> <span class="o">/</span> <span class="n">fs</span><span class="p">,</span> <span class="n">samples</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span>
</span><span class="line line-9"><span class="n">plt</span><span class="p">.</span><span class="nf">xlabel</span><span class="p">(</span><span class="sh">'</span><span class="s">Time (ms)</span><span class="sh">'</span><span class="p">)</span>
</span><span class="line line-10"><span class="n">plt</span><span class="p">.</span><span class="nf">ylabel</span><span class="p">(</span><span class="sh">'</span><span class="s">Amplitude</span><span class="sh">'</span><span class="p">)</span>
</span><span class="line line-11"><span class="n">plt</span><span class="p">.</span><span class="nf">xlim</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">N</span><span class="o">/</span><span class="n">fs</span><span class="p">)</span>
</span><span class="line line-12"><span class="n">plt</span><span class="p">.</span><span class="nf">ylim</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
</span></code></pre></td></tr></tbody></table>
</details>
<figure>
<img src="/assets/images/figures/2025-06-22-beat-the-odds-kickroll/samples.svg" class="dark-adaptive" alt="Waveform plot."/>

</figure>
<p>There is clearly a repeating pattern that is occurring at an gradually-increasing frequency. Each occurrence of the pattern is a kick. The task is to find the regularity of the kicks.</p>
<p>We can see that, at the start of each kick, the waveform is oscillating more rapidly than in later times of the kick. Therefore, a natural idea is to capture this high-frequency oscillation feature using the short-time Fourier transform (STFT), and we would expect to see some peaks at the high-frequency region of the spectrogram of the waveform at each kick occurrence. SciPy provides a convenient function for STFT, and then we can plot the spectrogram of the waveform:</p>
<details>
<summary>
Python code
</summary>
<table class="rouge-table"><tbody><tr><td class="highlight language-python"><pre><code><span class="line line-1"><span class="n">hop</span> <span class="o">=</span> <span class="mi">32</span>
</span><span class="line line-2"><span class="n">SFT</span> <span class="o">=</span> <span class="nc">ShortTimeFFT</span><span class="p">(</span><span class="nf">hann</span><span class="p">(</span><span class="n">hop</span><span class="p">),</span> <span class="n">hop</span><span class="p">,</span> <span class="n">fs</span><span class="p">)</span>
</span><span class="line line-3"><span class="n">spectrogram</span> <span class="o">=</span> <span class="n">SFT</span><span class="p">.</span><span class="nf">spectrogram</span><span class="p">(</span><span class="n">samples</span><span class="p">)</span>
</span><span class="line line-4">
</span><span class="line line-5"><span class="n">plt</span><span class="p">.</span><span class="nf">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">6</span><span class="p">))</span>
</span><span class="line line-6"><span class="n">im</span> <span class="o">=</span> <span class="n">plt</span><span class="p">.</span><span class="nf">imshow</span><span class="p">(</span>
</span><span class="line line-7">	<span class="n">spectrogram</span><span class="p">,</span>
</span><span class="line line-8">	<span class="n">aspect</span><span class="o">=</span><span class="sh">'</span><span class="s">auto</span><span class="sh">'</span><span class="p">,</span>
</span><span class="line line-9">	<span class="n">origin</span><span class="o">=</span><span class="sh">'</span><span class="s">lower</span><span class="sh">'</span><span class="p">,</span>
</span><span class="line line-10">	<span class="n">extent</span><span class="o">=</span><span class="n">SFT</span><span class="p">.</span><span class="nf">extent</span><span class="p">(</span><span class="n">N</span><span class="p">),</span>
</span><span class="line line-11">	<span class="n">norm</span><span class="o">=</span><span class="nc">LogNorm</span><span class="p">(</span><span class="n">vmin</span><span class="o">=</span><span class="mf">0.001</span><span class="p">,</span> <span class="n">vmax</span><span class="o">=</span><span class="n">np</span><span class="p">.</span><span class="nf">max</span><span class="p">(</span><span class="n">spectrogram</span><span class="p">)),</span>
</span><span class="line line-12"><span class="p">)</span>
</span><span class="line line-13"><span class="n">plt</span><span class="p">.</span><span class="nf">xlabel</span><span class="p">(</span><span class="sh">'</span><span class="s">Time (ms)</span><span class="sh">'</span><span class="p">)</span>
</span><span class="line line-14"><span class="n">plt</span><span class="p">.</span><span class="nf">ylabel</span><span class="p">(</span><span class="sh">'</span><span class="s">Frequency (kHz)</span><span class="sh">'</span><span class="p">)</span>
</span><span class="line line-15"><span class="n">plt</span><span class="p">.</span><span class="nf">colorbar</span><span class="p">(</span><span class="n">im</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="sh">'</span><span class="s">Magnitude</span><span class="sh">'</span><span class="p">)</span>
</span></code></pre></td></tr></tbody></table>
</details>
<figure>
<img src="/assets/images/figures/2025-06-22-beat-the-odds-kickroll/spectrogram.svg" class="dark-adaptive" alt="Spectrogram of the kick roll sample."/>

</figure>
<p>We can see that there are clearly some peaks at the high-frequency region of the spectrogram. Pick out the peaks:</p>
<details>
<summary>
Python code
</summary>
<table class="rouge-table"><tbody><tr><td class="highlight language-python"><pre><code><span class="line line-1"><span class="n">plt</span><span class="p">.</span><span class="nf">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">6</span><span class="p">))</span>
</span><span class="line line-2"><span class="n">data</span> <span class="o">=</span> <span class="n">spectrogram</span><span class="p">[</span><span class="mi">14</span><span class="p">:,</span> <span class="p">:].</span><span class="nf">mean</span><span class="p">(</span><span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
</span><span class="line line-3"><span class="n">peaks</span><span class="p">,</span> <span class="n">peak_properties</span> <span class="o">=</span> <span class="nf">find_peaks</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">height</span><span class="o">=</span><span class="mf">0.004</span><span class="p">,</span> <span class="n">distance</span><span class="o">=</span><span class="mi">7</span><span class="p">)</span>
</span><span class="line line-4"><span class="n">peaks</span> <span class="o">=</span> <span class="n">peaks</span> <span class="o">*</span> <span class="n">hop</span> <span class="o">/</span> <span class="n">fs</span>
</span><span class="line line-5"><span class="n">plt</span><span class="p">.</span><span class="nf">xlabel</span><span class="p">(</span><span class="sh">'</span><span class="s">Time (ms)</span><span class="sh">'</span><span class="p">)</span>
</span><span class="line line-6"><span class="n">plt</span><span class="p">.</span><span class="nf">ylabel</span><span class="p">(</span><span class="sh">'</span><span class="s">Average magnitude for high frequencies</span><span class="sh">'</span><span class="p">)</span>
</span><span class="line line-7"><span class="n">plt</span><span class="p">.</span><span class="nf">plot</span><span class="p">(</span><span class="n">SFT</span><span class="p">.</span><span class="nf">t</span><span class="p">(</span><span class="n">N</span><span class="p">),</span> <span class="n">data</span><span class="p">)</span>
</span><span class="line line-8"><span class="n">plt</span><span class="p">.</span><span class="nf">plot</span><span class="p">(</span><span class="n">peaks</span><span class="p">,</span> <span class="n">peak_properties</span><span class="p">[</span><span class="sh">'</span><span class="s">peak_heights</span><span class="sh">'</span><span class="p">],</span> <span class="sh">"</span><span class="s">o</span><span class="sh">"</span><span class="p">)</span>
</span></code></pre></td></tr></tbody></table>
</details>
<figure>
<img src="/assets/images/figures/2025-06-22-beat-the-odds-kickroll/peaks.svg" class="dark-adaptive" alt="Each peak is approximately at the start of a kick."/>

</figure>
<p>To check that those peaks make sense, we can mark the positions of the peaks on the waveform to see if they are indeed approximately at the start of each kick:</p>
<details>
<summary>
Python code
</summary>
<table class="rouge-table"><tbody><tr><td class="highlight language-python"><pre><code><span class="line line-1"><span class="n">plt</span><span class="p">.</span><span class="nf">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">6</span><span class="p">))</span>
</span><span class="line line-2"><span class="n">plt</span><span class="p">.</span><span class="nf">plot</span><span class="p">(</span><span class="n">np</span><span class="p">.</span><span class="nf">arange</span><span class="p">(</span><span class="n">N</span><span class="p">)</span> <span class="o">/</span> <span class="n">fs</span><span class="p">,</span> <span class="n">samples</span><span class="p">)</span>
</span><span class="line line-3"><span class="k">for</span> <span class="n">peak</span> <span class="ow">in</span> <span class="n">peaks</span><span class="p">:</span>
</span><span class="line line-4">	<span class="n">plt</span><span class="p">.</span><span class="nf">axvline</span><span class="p">(</span><span class="n">peak</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="sh">'</span><span class="s">red</span><span class="sh">'</span><span class="p">)</span>
</span><span class="line line-5"><span class="n">plt</span><span class="p">.</span><span class="nf">xlabel</span><span class="p">(</span><span class="sh">'</span><span class="s">Time (ms)</span><span class="sh">'</span><span class="p">)</span>
</span><span class="line line-6"><span class="n">plt</span><span class="p">.</span><span class="nf">ylabel</span><span class="p">(</span><span class="sh">'</span><span class="s">Amplitude</span><span class="sh">'</span><span class="p">)</span>
</span><span class="line line-7"><span class="n">plt</span><span class="p">.</span><span class="nf">xlim</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">200</span><span class="p">)</span>
</span><span class="line line-8"><span class="n">plt</span><span class="p">.</span><span class="nf">ylim</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
</span></code></pre></td></tr></tbody></table>
</details>
<figure>
<img src="/assets/images/figures/2025-06-22-beat-the-odds-kickroll/peaks_on_samples.svg" class="dark-adaptive" alt="Waveform with high-frequency spectrogram peaks marked."/>

</figure>
<p>We can see that although they are not perfectly at the start of each kick, the peaks are indeed approximately at the start of each kick. Now, plot the time intervals between each pair of consecutive peaks. If the plot is in log-scale, one can see that they approximately form a straight line, which means that the time intervals decay geometrically. We can use a simple linear regression to fit the data.</p>
<details>
<summary>
Python code
</summary>
<table class="rouge-table"><tbody><tr><td class="highlight language-python"><pre><code><span class="line line-1"><span class="n">fig</span><span class="p">,</span> <span class="n">ax</span> <span class="o">=</span> <span class="n">plt</span><span class="p">.</span><span class="nf">subplots</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">6</span><span class="p">))</span>
</span><span class="line line-2"><span class="n">ax</span><span class="p">.</span><span class="nf">set_yscale</span><span class="p">(</span><span class="sh">'</span><span class="s">log</span><span class="sh">'</span><span class="p">)</span>
</span><span class="line line-3"><span class="n">intervals</span> <span class="o">=</span> <span class="n">np</span><span class="p">.</span><span class="nf">diff</span><span class="p">(</span><span class="n">peaks</span><span class="p">)</span>
</span><span class="line line-4"><span class="n">indices</span> <span class="o">=</span> <span class="n">np</span><span class="p">.</span><span class="nf">arange</span><span class="p">(</span><span class="nf">len</span><span class="p">(</span><span class="n">intervals</span><span class="p">))</span>
</span><span class="line line-5"><span class="n">lin_res</span> <span class="o">=</span> <span class="nf">linregress</span><span class="p">(</span><span class="n">indices</span><span class="p">,</span> <span class="n">np</span><span class="p">.</span><span class="nf">log</span><span class="p">(</span><span class="n">intervals</span><span class="p">))</span>
</span><span class="line line-6"><span class="n">ax</span><span class="p">.</span><span class="nf">plot</span><span class="p">(</span><span class="n">indices</span><span class="p">,</span> <span class="n">intervals</span><span class="p">,</span> <span class="sh">'</span><span class="s">o</span><span class="sh">'</span><span class="p">)</span>
</span><span class="line line-7"><span class="n">ax</span><span class="p">.</span><span class="nf">plot</span><span class="p">(</span><span class="n">indices</span><span class="p">,</span> <span class="n">np</span><span class="p">.</span><span class="nf">exp</span><span class="p">(</span><span class="n">lin_res</span><span class="p">.</span><span class="n">intercept</span> <span class="o">+</span> <span class="n">lin_res</span><span class="p">.</span><span class="n">slope</span> <span class="o">*</span> <span class="n">indices</span><span class="p">))</span>
</span><span class="line line-8"><span class="n">ax</span><span class="p">.</span><span class="nf">set_xlabel</span><span class="p">(</span><span class="sh">'</span><span class="s">Kick</span><span class="sh">'</span><span class="p">)</span>
</span><span class="line line-9"><span class="n">ax</span><span class="p">.</span><span class="nf">set_ylabel</span><span class="p">(</span><span class="sh">'</span><span class="s">Interval (ms)</span><span class="sh">'</span><span class="p">)</span>
</span></code></pre></td></tr></tbody></table>
</details>
<figure>
<img src="/assets/images/figures/2025-06-22-beat-the-odds-kickroll/intervals.svg" class="dark-adaptive" alt="Intervals between consecutive peaks."/>

</figure>
<p>With the linear regression, we can conclude that the decay ratio is <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0.9762</mn></mrow><annotation encoding="application/x-tex">0.9762</annotation></semantics></math></span></span>.</p>
<p>If we had guessed that the time intervals decay geometrically and that the first kick has the length of a 32nd note, we could calculate the decay ratio <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>a</mi></mrow><annotation encoding="application/x-tex">a</annotation></semantics></math></span></span> by solving the equation <span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mfrac><mn>1</mn><mn>8</mn></mfrac><mrow><mo fence="true">(</mo><mn>1</mn><mo>−</mo><msup><mi>a</mi><mn>59</mn></msup><mo fence="true">)</mo></mrow><mo>=</mo><mn>4</mn><mrow><mo fence="true">(</mo><mn>1</mn><mo>−</mo><mi>a</mi><mo fence="true">)</mo></mrow><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">\fr18\p{1-a^{59}}=4\p{1-a},</annotation></semantics></math></span></span></span> where <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mi mathvariant="normal">/</mi><mn>8</mn></mrow><annotation encoding="application/x-tex">1/8</annotation></semantics></math></span></span> is the note value of a 32nd note, and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>4</mn></mrow><annotation encoding="application/x-tex">4</annotation></semantics></math></span></span> is the total note value of this kickroll (a measure with <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>4</mn></mrow><annotation encoding="application/x-tex">4</annotation></semantics></math></span></span> quarter notes), and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>59</mn></mrow><annotation encoding="application/x-tex">59</annotation></semantics></math></span></span> is the total number of kicks (obtained by counting the patterns in the waveform). Solving this equation numerically gives us <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>a</mi><mo>=</mo><mn>0.9764</mn></mrow><annotation encoding="application/x-tex">a=0.9764</annotation></semantics></math></span></span>, which is pretty close to the value we got before.</p>]]></content><author><name>UlyssesZhan</name><email>ulysseszhan@gmail.com</email></author><category term="music" /><category term="fourier transform" /><category term="python" /><summary type="html"><![CDATA[There is a gradually-accelerating buildup kickroll at 1:18 in the song <cite>Time to beat the odds</cite> by 影虎。. In order to know the details of this rhythm, I have to analyze the sample using Python. The main method is to do a short-time Fourier transform and to find the peaks in the high-frequency region of the spectrogram. A linear regression shows that the time intervals decay geometrically.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ulysseszh.github.io/assets/images/covers/2025-06-22-beat-the-odds-kickroll.png" /><media:content medium="image" url="https://ulysseszh.github.io/assets/images/covers/2025-06-22-beat-the-odds-kickroll.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html"><![CDATA[The frequency assignment of musical notes]]></title><link href="https://ulysseszh.github.io/music/2020/03/27/notes-frequency.html" rel="alternate" type="text/html" title="The frequency assignment of musical notes" /><published>2020-03-27T00:31:55-07:00</published><updated>2020-03-27T00:31:55-07:00</updated><id>https://ulysseszh.github.io/music/2020/03/27/notes-frequency</id><content type="html" xml:base="https://ulysseszh.github.io/music/2020/03/27/notes-frequency.html"><![CDATA[<h2 data-label="0.1" id="the-notes">The notes</h2>
<p>First, let’s define what is a <em>note</em>.</p>
<p>A note is an element of the countable set <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>N</mi></mrow><annotation encoding="application/x-tex">N</annotation></semantics></math></span></span>. Here exists a bijection from <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="double-struck">Z</mi></mrow><annotation encoding="application/x-tex">\mathbb Z</annotation></semantics></math></span></span> to <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>N</mi></mrow><annotation encoding="application/x-tex">N</annotation></semantics></math></span></span> denoted as <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>k</mi><mo>↦</mo><msub><mi>ν</mi><mi>k</mi></msub></mrow><annotation encoding="application/x-tex">k\mapsto \nu_k</annotation></semantics></math></span></span>. Therefore, all notes form a sequence <span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo>…</mo><mo separator="true">,</mo><msub><mi>ν</mi><mrow><mo>−</mo><mn>2</mn></mrow></msub><mo separator="true">,</mo><msub><mi>ν</mi><mrow><mo>−</mo><mn>1</mn></mrow></msub><mo separator="true">,</mo><msub><mi>ν</mi><mn>0</mn></msub><mo separator="true">,</mo><msub><mi>ν</mi><mn>1</mn></msub><mo separator="true">,</mo><msub><mi>ν</mi><mn>2</mn></msub><mo separator="true">,</mo><mo>…</mo></mrow><annotation encoding="application/x-tex">
    \dots,\nu_{-2},\nu_{-1},\nu_0,\nu_1,\nu_2,\dots
</annotation></semantics></math></span></span></span></p>
<p>Our goal is to define a <em>frequency assignment</em>, which is a mapping <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>f</mi><mo>:</mo><mi>N</mi><mo>→</mo><msup><mi mathvariant="double-struck">R</mi><mo>+</mo></msup></mrow><annotation encoding="application/x-tex">f:N\rightarrow\mathbb R^+</annotation></semantics></math></span></span>, whose meaning is the frequency (in Hz) of the sound of a note.</p>
<p>It is a natural idea to define a sequence <span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msub><mi>f</mi><mi>k</mi></msub><mo><mi mathvariant="normal">≔</mi></mo><mi>f</mi><mtext> ⁣</mtext><mrow><mo fence="true">(</mo><msub><mi>ν</mi><mi>k</mi></msub><mo fence="true">)</mo></mrow><mi mathvariant="normal">.</mi></mrow><annotation encoding="application/x-tex">
    f_k\coloneqq f\!\left(\nu_k\right).
</annotation></semantics></math></span></span></span></p>
<p>It makes sense that the sequence is in strictly increasing order.</p>
<h2 data-label="0.2" id="the-octaves">The octaves</h2>
<p>Now, let’s think about a <em>musical interval</em>. At this stage, a musical interval can be defined as an unordered pair of notes. After long time of experimenting, people find that they tend to think a musical interval extremely harmonic if it consists of such two notes that the frequency of one of them doubles that of the other.</p>
<p>In other words, the musical interval of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>ν</mi><mi>a</mi></msub></mrow><annotation encoding="application/x-tex">\nu_a</annotation></semantics></math></span></span> and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>ν</mi><mi>b</mi></msub></mrow><annotation encoding="application/x-tex">\nu_b</annotation></semantics></math></span></span> is extremely harmonic if <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>f</mi><mi>b</mi></msub><mo>=</mo><mn>2</mn><msub><mi>f</mi><mi>a</mi></msub></mrow><annotation encoding="application/x-tex">f_b=2f_a</annotation></semantics></math></span></span>. In fact, it is so harmonic that if the two notes are played simultaneously, a person tend to think there is only one note being played:</p>
<!-- markdownlint-disable no-inline-html -->
<audio controls="">
<source src="/assets/audios/octave_interval.mp3" type="audio/mpeg">
<p>(Your browser does not support the audio element.) </p></source></audio> <!-- markdownlint-enable no-inline-html -->
<table class="rouge-table">
  <tbody>
    <tr>
      <td class="highlight language-alda">
        <pre>
          <code>
            <span class="line line-1">motif = c4 c g g a a g2
</span>
            <span class="line line-2">piano:
</span>
            <span class="line line-3">V1: o4 motif motif
</span>
            <span class="line line-4">V2: o5 motif
</span>
          </code>
        </pre>
      </td>
    </tr>
  </tbody>
</table>
<p>The audio above is an illustration for octave intervals. As can be heard, the first part of the audio is played in octave intervals while the second part is played in single notes.</p>
<p>Considering that, here comes an amazing idea by which we can kind of make the sequence <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo fence="true">{</mo><msub><mi>f</mi><mi>k</mi></msub><mo fence="true">}</mo></mrow><annotation encoding="application/x-tex">\left\{f_k\right\}</annotation></semantics></math></span></span> seem “periodic”. Let the “period” be denoted as <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span></span>. Because it is not virtually periodic, we tend to call it an <em>octave</em> instead of a period. After that, the constant <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span></span> is the length of an octave.</p>
<p>What on earth is an octave defined? It is <span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi mathvariant="normal">∀</mi><mi>k</mi><mo>:</mo><msub><mi>f</mi><mrow><mi>k</mi><mo>+</mo><mi>n</mi></mrow></msub><mo>=</mo><mn>2</mn><msub><mi>f</mi><mi>k</mi></msub><mi mathvariant="normal">.</mi></mrow><annotation encoding="application/x-tex">
    \forall k:f_{k+n}=2f_k.
</annotation></semantics></math></span></span></span> Why do we say an octave is like a period? It is because according to the explanation above, corresponding notes in different octaves sound so harmonic that a person almost think they are the same. In this way, for some questions, we only need to consider a single octave instead of all notes. Let’s define the <em>base octave</em>, notes of which can generate all other notes by multiplying the frequency by a power of 2: <span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msub><mi>O</mi><mn>0</mn></msub><mo><mi mathvariant="normal">≔</mi></mo><mrow><mo fence="true">{</mo><msub><mi>ν</mi><mi>k</mi></msub><mtext> </mtext><mo fence="true" lspace="0.05em" rspace="0.05em">|</mo><mtext> </mtext><mi>k</mi><mo>∈</mo><mi>T</mi><mo fence="true">}</mo></mrow><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">
    O_0\coloneqq\left\{\nu_k\,\middle|\,k\in T\right\},
</annotation></semantics></math></span></span></span> so we can say the frequency assignment has <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span></span> different tones. A <em>tone</em> is an integer in <span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi>T</mi><mo><mi mathvariant="normal">≔</mi></mo><mrow><mo fence="true">[</mo><mn>0</mn><mo separator="true">,</mo><mi>n</mi><mo fence="true">)</mo></mrow><mo>∩</mo><mi mathvariant="double-struck">Z</mi></mrow><annotation encoding="application/x-tex">
    T\coloneqq\left[0,n\right)\cap\mathbb Z
</annotation></semantics></math></span></span></span> representing where a note is in an octave.</p>
<p>We can thus define a sequence of octaves <span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msub><mi>O</mi><mi>m</mi></msub><mo><mi mathvariant="normal">≔</mi></mo><mrow><mo fence="true">{</mo><msub><mi>ν</mi><mrow><mi>k</mi><mo>+</mo><mi>m</mi><mi>n</mi></mrow></msub><mtext> </mtext><mo fence="true" lspace="0.05em" rspace="0.05em">|</mo><mtext> </mtext><msub><mi>ν</mi><mi>k</mi></msub><mo>∈</mo><msub><mi>O</mi><mn>0</mn></msub><mo fence="true">}</mo></mrow><mi mathvariant="normal">.</mi></mrow><annotation encoding="application/x-tex">
    O_m\coloneqq\left\{\nu_{k+mn}\,\middle|\,\nu_k\in O_0\right\}.
</annotation></semantics></math></span></span></span></p>
<p>In fact, any octave can be the base octave. They are all the same. For any <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>m</mi></mrow><annotation encoding="application/x-tex">m</annotation></semantics></math></span></span>, all notes can be generated by notes in <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>O</mi><mi>m</mi></msub></mrow><annotation encoding="application/x-tex">O_m</annotation></semantics></math></span></span>. <span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><menclose notation="top bottom left right"><mtable rowspacing="0.16em" columnalign="center center center center center center center" columnlines="solid none none none none none" columnspacing="1em" rowlines="solid none none none none"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mi>T</mi></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>O</mi><mrow><mo>−</mo><mn>1</mn></mrow></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>O</mi><mn>0</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>O</mi><mn>1</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>O</mi><mn>2</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>0</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mrow><mo>−</mo><mi>n</mi></mrow></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>0</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mi>l</mi></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mrow><mn>2</mn><mi>n</mi></mrow></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>1</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mrow><mo>−</mo><mi>n</mi><mo>+</mo><mn>1</mn></mrow></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>1</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mrow><mi>n</mi><mo>+</mo><mn>1</mn></mrow></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mrow><mn>2</mn><mi>n</mi><mo>+</mo><mn>1</mn></mrow></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>2</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mrow><mo>−</mo><mi>n</mi><mo>+</mo><mn>2</mn></mrow></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>2</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mrow><mi>n</mi><mo>+</mo><mn>2</mn></mrow></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mrow><mn>2</mn><mi>n</mi><mo>+</mo><mn>2</mn></mrow></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><mi>n</mi><mo>−</mo><mn>1</mn></mrow></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mrow><mo>−</mo><mn>1</mn></mrow></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mrow><mi>n</mi><mo>−</mo><mn>1</mn></mrow></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mrow><mn>2</mn><mi>n</mi><mo>−</mo><mn>1</mn></mrow></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mrow><mn>3</mn><mi>n</mi><mo>−</mo><mn>1</mn></mrow></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⋯</mo></mstyle></mtd></mtr></mtable></menclose></mrow><annotation encoding="application/x-tex">
\begin{array}{|c|cccccc|}
    \hline
    T &amp; \cdots &amp; O_{-1} &amp; O_0 &amp; O_1 &amp; O_2 &amp; \cdots\\
    \hline
    0&amp;\cdots&amp; \nu_{-n}&amp;\nu_0&amp; \nu_l &amp; \nu_{2n}&amp;\cdots\\
    1&amp;\cdots&amp;\nu_{-n+1}&amp;\nu_1&amp;\nu_{n+1}&amp;\nu_{2n+1}&amp;\cdots\\
    2&amp;\cdots&amp;\nu_{-n+2}&amp;\nu_2&amp;\nu_{n+2}&amp;\nu_{2n+2}&amp;\cdots\\
    \cdots&amp;\cdots&amp;\cdots&amp;\cdots&amp;\cdots&amp;\cdots&amp;\cdots\\
    n-1&amp;\cdots&amp;\nu_{-1}&amp;\nu_{n-1}&amp;\nu_{2n-1}&amp;\nu_{3n-1}&amp;\cdots\\
    \hline
\end{array}
</annotation></semantics></math></span></span></span>
If we define <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>p</mi><mi>k</mi></msub><mo><mi mathvariant="normal">≔</mi></mo><msub><mrow><mi>log</mi><mo>⁡</mo></mrow><mn>2</mn></msub><msub><mi>f</mi><mi>k</mi></msub></mrow><annotation encoding="application/x-tex">p_k\coloneqq\log_2f_k</annotation></semantics></math></span></span>, it is interesting to see that <span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi mathvariant="normal">∀</mi><mi>k</mi><mo>:</mo><msub><mi>p</mi><mrow><mi>k</mi><mo>+</mo><mi>n</mi></mrow></msub><mo>=</mo><msub><mi>p</mi><mi>k</mi></msub><mo>+</mo><mn>1.</mn></mrow><annotation encoding="application/x-tex">
    \forall k:p_{k+n}=p_k+1.
</annotation></semantics></math></span></span></span> From that, we can naturally think an excellent frequency assignment be defined as <span id="eq:p-freq-def" data-label="(1)"><span class="katex-display-table"> <span class="katex-display-numbered"><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msub><mi>p</mi><mi>k</mi></msub><mo><mi mathvariant="normal">≔</mi></mo><msub><mi>p</mi><mn>0</mn></msub><mo>+</mo><mfrac><mi>k</mi><mi>n</mi></mfrac><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">p_k\coloneqq p_0+\frac kn,</annotation></semantics></math></span></span></span></span> <span class="katex-display-number"><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo stretchy="false">(</mo><mn>1</mn><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(1)</annotation></semantics></math></span></span></span></span> </span></span> which is an elegant arithmetic progression.</p>
<h2 data-label="0.3" id="the-octave-group">The octave group</h2>
<p>Note that here “group” is the group concept in algebra.</p>
<p>Let <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>O</mi><mn>0</mn></msub></mrow><annotation encoding="application/x-tex">O_0</annotation></semantics></math></span></span> be isomorphic to the additive group of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="double-struck">Z</mi><mi mathvariant="normal">/</mi><mi>n</mi><mi mathvariant="double-struck">Z</mi></mrow><annotation encoding="application/x-tex">\mathbb Z/n\mathbb Z</annotation></semantics></math></span></span>, the integers modulo <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span></span>, under the isomorphism <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>k</mi><mo>↦</mo><msub><mi>ν</mi><mi>k</mi></msub></mrow><annotation encoding="application/x-tex">k\mapsto\nu_k</annotation></semantics></math></span></span>, which means to make <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>O</mi><mn>0</mn></msub></mrow><annotation encoding="application/x-tex">O_0</annotation></semantics></math></span></span> a cyclic group of order <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span></span>. I call this group an <em>octave group</em>.</p>
<p>To make you have a good sense of what on earth the group looks like, the definition of its group operation can be defined as <span id="eq:group-op-def" data-label="(2)"><span class="katex-display-table"> <span class="katex-display-numbered"><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msub><mi>ν</mi><mi>a</mi></msub><mo>∘</mo><msub><mi>ν</mi><mi>b</mi></msub><mo><mi mathvariant="normal">≔</mi></mo><msub><mi>ν</mi><mrow><mrow><mo fence="true">(</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo fence="true">)</mo></mrow><mo mathvariant="normal" lspace="0.22em" rspace="0.22em">%</mo><mi>n</mi></mrow></msub><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">\nu_a\circ\nu_b\coloneqq\nu_{\left(a+b\right)\mathbin\%n},</annotation></semantics></math></span></span></span></span> <span class="katex-display-number"><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo stretchy="false">(</mo><mn>2</mn><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(2)</annotation></semantics></math></span></span></span></span> </span></span> where <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>x</mi><mo mathvariant="normal" lspace="0.22em" rspace="0.22em">%</mo><mi>y</mi><mo><mi mathvariant="normal">≔</mi></mo><mi>x</mi><mo>−</mo><mi>y</mi><mrow><mo fence="true">⌊</mo><mfrac><mi>x</mi><mi>y</mi></mfrac><mo fence="true">⌋</mo></mrow></mrow><annotation encoding="application/x-tex">x\mathbin\%y\coloneqq x-y\left\lfloor\frac xy\right\rfloor</annotation></semantics></math></span></span>.</p>
<p>Note that this binary operator <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo>∘</mo></mrow><annotation encoding="application/x-tex">\circ</annotation></semantics></math></span></span> can be extended to be used for the whole <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>N</mi></mrow><annotation encoding="application/x-tex">N</annotation></semantics></math></span></span> while the definition remains the same as Formula <a href="#eq:group-op-def">2</a>.</p>
<!--
Let

$$
    Q\coloneqq\left\{\frac kn\,\middle|\,
    k\in T\right\}.
$$

It is obvious that $q\mapsto \nu_{\left(m+q\right)n}$
is a bijection from $Q$ to $O_m$. Pointing out such a bijection
is natural because elements in $Q$ seem to have
a similar form to that of $p_k$ in Formula [@eq:p-freq-def].

In fact, $Q$ is a group of size $T$ whose group operation is
defined as

$$
    q_1\circ q_2\coloneqq q_1+q_2-\left\lfloor q_1+q_2\right\rfloor.
$$

In this way, $\left(Q,\circ\right)$ forms a group, as can
be verified:
1. The closure and associativity can be verified.
1. The identity element is $0$.
1. The inverse elemeent of $q$ is $q^{\circ-1}=1-q$.

With the bijection (or isomorphism)
$q\mapsto \nu_{\left(m+q\right)n}$, we can
also define a group operation $\circ$ on $O_m$.
Therefore, we can call $\left(O_m,\circ\right)$
an *octave group*.
-->
<p>The octave group has a musical meaning which we should take a further look at musical intervals to find out.</p>
<h2 data-label="0.4" id="the-musical-intervals">The musical intervals</h2>
<p>Taking Formula <a href="#eq:p-freq-def">1</a>, people find that although it is sometimes subjective whether a musical interval sounds harmonic or not, it does not depend on where the interval is located but on how far the two notes making up the interval are.</p>
<p>Taking this sense, we can consider only those intervals involving <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>ν</mi><mn>0</mn></msub></mrow><annotation encoding="application/x-tex">\nu_0</annotation></semantics></math></span></span> because we can always translate a interval so that one of its notes is <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>ν</mi><mn>0</mn></msub></mrow><annotation encoding="application/x-tex">\nu_0</annotation></semantics></math></span></span>. Taking this idea, we can conclude that an interval can be represented by a note <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>ν</mi><mi>k</mi></msub></mrow><annotation encoding="application/x-tex">\nu_k</annotation></semantics></math></span></span> because the interval is equivalent to another interval which consists of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>ν</mi><mn>0</mn></msub></mrow><annotation encoding="application/x-tex">\nu_0</annotation></semantics></math></span></span> and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>ν</mi><mi>k</mi></msub></mrow><annotation encoding="application/x-tex">\nu_k</annotation></semantics></math></span></span>.</p>
<p>We can make this idea even further. Previously, I have stated that a note can always be generated by a note in <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>O</mi><mn>0</mn></msub></mrow><annotation encoding="application/x-tex">O_0</annotation></semantics></math></span></span>. Therefore, an interval can be represented as a note in <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>O</mi><mn>0</mn></msub></mrow><annotation encoding="application/x-tex">O_0</annotation></semantics></math></span></span>.</p>
<p>Now, let’s look back to the octave group <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo fence="true">(</mo><msub><mi>O</mi><mn>0</mn></msub><mo separator="true">,</mo><mo>∘</mo><mo fence="true">)</mo></mrow><annotation encoding="application/x-tex">\left(O_0,\circ\right)</annotation></semantics></math></span></span>. Denote the interval <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi></mrow><annotation encoding="application/x-tex">b</annotation></semantics></math></span></span> as that represented by <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>ν</mi><mi>b</mi></msub></mrow><annotation encoding="application/x-tex">\nu_b</annotation></semantics></math></span></span>. Then, translate interval <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi></mrow><annotation encoding="application/x-tex">b</annotation></semantics></math></span></span> to such a location that its lower note is <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>ν</mi><mi>a</mi></msub></mrow><annotation encoding="application/x-tex">\nu_a</annotation></semantics></math></span></span>. Then, its higher note represents the same interval as <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>ν</mi><mi>a</mi></msub><mo>∘</mo><msub><mi>ν</mi><mi>b</mi></msub></mrow><annotation encoding="application/x-tex">\nu_a\circ\nu_b</annotation></semantics></math></span></span>.</p>
<p>Well, why do we focus on the group? It is because we need to mention an important concept in group theory, which is “generator”. It has something to do with determining the value of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span></span>.</p>
<p>The value of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>p</mi><mn>0</mn></msub></mrow><annotation encoding="application/x-tex">p_0</annotation></semantics></math></span></span> does not matter because changing it is just a translation of the whole sequence. What really matters is the value of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span></span>.</p>
<p>The inventor of the current prevailing frequency assignment (which is the <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>12</mn></mrow><annotation encoding="application/x-tex">12</annotation></semantics></math></span></span>-tone equal temperament shown in Formula <a href="#eq:12-equal-def">3</a>) may think the generator of the group a vital thing. Actually, people think it a wonderful thing that a note representing a very harmonic interval is a generator of the octave group.</p>
<p>Fortunately, such a goal is achievable. People find that if <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>p</mi><mi>b</mi></msub><mo>=</mo><msub><mi>p</mi><mi>a</mi></msub><mo>+</mo><mfrac><mn>7</mn><mn>12</mn></mfrac></mrow><annotation encoding="application/x-tex">p_b=p_a+\frac7{12}</annotation></semantics></math></span></span>, then the interval (which is the perfect fifth interval if you know music theory) consisting of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>ν</mi><mi>a</mi></msub></mrow><annotation encoding="application/x-tex">\nu_a</annotation></semantics></math></span></span> and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>ν</mi><mi>b</mi></msub></mrow><annotation encoding="application/x-tex">\nu_b</annotation></semantics></math></span></span> sounds very harmonic:</p>
<!-- markdownlint-disable no-inline-html -->
<audio controls="">
<source src="/assets/audios/fifth_interval.mp3" type="audio/mpeg">
<p>(Your browser does not support the audio element.) </p></source></audio> <!-- markdownlint-enable no-inline-html -->
<table class="rouge-table">
  <tbody>
    <tr>
      <td class="highlight language-alda">
        <pre>
          <code>
            <span class="line line-1">motif = e4 a f2 d4 g c2
</span>
            <span class="line line-2">piano:
</span>
            <span class="line line-3">V1: motif
</span>
            <span class="line line-4">V2: (transpose 7) motif
</span>
          </code>
        </pre>
      </td>
    </tr>
  </tbody>
</table>
<p>Furthermore, as can be seen in the following table, <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>ν</mi><mn>7</mn></msub></mrow><annotation encoding="application/x-tex">\nu_7</annotation></semantics></math></span></span> is a generator of the group <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>O</mi><mn>0</mn></msub></mrow><annotation encoding="application/x-tex">O_0</annotation></semantics></math></span></span> if <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi><mo><mi mathvariant="normal">≔</mi></mo><mn>12</mn></mrow><annotation encoding="application/x-tex">n\coloneqq12</annotation></semantics></math></span></span>: <span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><menclose notation="top bottom left right"><mtable rowspacing="0.16em" columnalign="center center center center center center center center center center center center center" columnlines="solid none none none none none none none none none none none" columnspacing="1em" rowlines="solid"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mi>j</mi></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>0</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>1</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>2</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>3</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>4</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>5</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>6</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>7</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>8</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>9</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>10</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>11</mn></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><msubsup><mi>ν</mi><mn>7</mn><mrow><mo>∘</mo><mi>j</mi></mrow></msubsup></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>0</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>7</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>2</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>9</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>4</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>11</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>6</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>1</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>8</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>3</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>10</mn></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msub><mi>ν</mi><mn>5</mn></msub></mstyle></mtd></mtr></mtable></menclose></mrow><annotation encoding="application/x-tex">
\begin{array}{|c|cccccccccccc|}
    \hline
    j&amp;0&amp;1&amp;2&amp;3&amp;4&amp;5&amp;6&amp;7&amp;8&amp;9&amp;10&amp;11
    \\\hline
    \nu_7^{\circ j}&amp;
    \nu_0&amp;\nu_7&amp;\nu_2&amp;\nu_9&amp;\nu_4&amp;\nu_{11}&amp;\nu_6&amp;\nu_1&amp;
    \nu_8&amp;\nu_3&amp;\nu_{10}&amp;\nu_5
    \\\hline
\end{array}
</annotation></semantics></math></span></span></span>
Thus, wonderful! Let’s take <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi><mo><mi mathvariant="normal">≔</mi></mo><mn>12</mn></mrow><annotation encoding="application/x-tex">n\coloneqq12</annotation></semantics></math></span></span>.</p>
<h2 data-label="0.5" id="the-12-tone-equal-temperament">The <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>12</mn></mrow><annotation encoding="application/x-tex">12</annotation></semantics></math></span></span>-tone equal temperament</h2>
<p>The <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>12</mn></mrow><annotation encoding="application/x-tex">12</annotation></semantics></math></span></span>-tone equal temperament is the most popular frequency assignment used nowadays. It is defined as <span id="eq:12-equal-def" data-label="(3)"><span class="katex-display-table"> <span class="katex-display-numbered"><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msub><mi>f</mi><mi>k</mi></msub><mo><mi mathvariant="normal">≔</mi></mo><mn>16.3516</mn><mo>⋅</mo><msup><mn>2</mn><mfrac><mi>k</mi><mn>12</mn></mfrac></msup><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">f_k\coloneqq16.3516\cdot 2^\frac k{12},</annotation></semantics></math></span></span></span></span> <span class="katex-display-number"><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo stretchy="false">(</mo><mn>3</mn><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(3)</annotation></semantics></math></span></span></span></span> </span></span> which can be derived from Formula <a href="#eq:p-freq-def">1</a> taking <span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msub><mi>p</mi><mn>0</mn></msub><mo><mi mathvariant="normal">≔</mi></mo><mn>4.03136</mn><mspace width="2em"/><mi>n</mi><mo><mi mathvariant="normal">≔</mi></mo><mn>12.</mn></mrow><annotation encoding="application/x-tex">
    p_0\coloneqq4.03136\qquad n\coloneqq12.
</annotation></semantics></math></span></span></span></p>
<p>The frequency assignment has <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>12</mn></mrow><annotation encoding="application/x-tex">12</annotation></semantics></math></span></span> different tones, <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>7</mn></mrow><annotation encoding="application/x-tex">7</annotation></semantics></math></span></span> of which have their names: <span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mtable rowspacing="0.25em" columnalign="right left" columnspacing="0em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="true"><msub><mi mathvariant="normal">C</mi><mi>m</mi></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="true"><mrow><mrow/><mo><mi mathvariant="normal">≔</mi></mo><msub><mi>ν</mi><mrow><mn>12</mn><mi>m</mi></mrow></msub><mo separator="true">,</mo></mrow></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="true"><msub><mi mathvariant="normal">D</mi><mi>m</mi></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="true"><mrow><mrow/><mo><mi mathvariant="normal">≔</mi></mo><msub><mi>ν</mi><mrow><mn>12</mn><mi>m</mi><mo>+</mo><mn>2</mn></mrow></msub><mo separator="true">,</mo></mrow></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="true"><msub><mi mathvariant="normal">E</mi><mi>m</mi></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="true"><mrow><mrow/><mo><mi mathvariant="normal">≔</mi></mo><msub><mi>ν</mi><mrow><mn>12</mn><mi>m</mi><mo>+</mo><mn>4</mn></mrow></msub><mo separator="true">,</mo></mrow></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="true"><msub><mi mathvariant="normal">F</mi><mi>m</mi></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="true"><mrow><mrow/><mo><mi mathvariant="normal">≔</mi></mo><msub><mi>ν</mi><mrow><mn>12</mn><mi>m</mi><mo>+</mo><mn>5</mn></mrow></msub><mo separator="true">,</mo></mrow></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="true"><msub><mi mathvariant="normal">G</mi><mi>m</mi></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="true"><mrow><mrow/><mo><mi mathvariant="normal">≔</mi></mo><msub><mi>ν</mi><mrow><mn>12</mn><mi>m</mi><mo>+</mo><mn>7</mn></mrow></msub><mo separator="true">,</mo></mrow></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="true"><msub><mi mathvariant="normal">A</mi><mi>m</mi></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="true"><mrow><mrow/><mo><mi mathvariant="normal">≔</mi></mo><msub><mi>ν</mi><mrow><mn>12</mn><mi>m</mi><mo>+</mo><mn>9</mn></mrow></msub><mo separator="true">,</mo></mrow></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="true"><msub><mi mathvariant="normal">B</mi><mi>m</mi></msub></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="true"><mrow><mrow/><mo><mi mathvariant="normal">≔</mi></mo><msub><mi>ν</mi><mrow><mn>12</mn><mi>m</mi><mo>+</mo><mn>11</mn></mrow></msub><mi mathvariant="normal">.</mi></mrow></mstyle></mtd></mtr></mtable><annotation encoding="application/x-tex">
\begin{align*}
    \mathrm C_m&amp;\coloneqq\nu_{12m},\\
    \mathrm D_m&amp;\coloneqq\nu_{12m+2},\\
    \mathrm E_m&amp;\coloneqq\nu_{12m+4},\\
    \mathrm F_m&amp;\coloneqq\nu_{12m+5},\\
    \mathrm G_m&amp;\coloneqq\nu_{12m+7},\\
    \mathrm A_m&amp;\coloneqq\nu_{12m+9},\\
    \mathrm B_m&amp;\coloneqq\nu_{12m+11}.
\end{align*}
</annotation></semantics></math></span></span></span>
The famous “middle C” is <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi mathvariant="normal">C</mi><mn>4</mn></msub></mrow><annotation encoding="application/x-tex">\mathrm C_4</annotation></semantics></math></span></span>.</p>
<p>This notation is called the <a href="https://en.wikipedia.org/wiki/Scientific_pitch_notation" target="_blank" rel="external"><em>scientific pitch notation</em></a>.</p>
<p>Note that in fact, this definition of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>12</mn></mrow><annotation encoding="application/x-tex">12</annotation></semantics></math></span></span>-tone equal temperament has some slight error. The accurate value for <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>p</mi><mn>0</mn></msub></mrow><annotation encoding="application/x-tex">p_0</annotation></semantics></math></span></span> is <span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msub><mi>p</mi><mn>0</mn></msub><mo><mi mathvariant="normal">≔</mi></mo><msub><mrow><mi>log</mi><mo>⁡</mo></mrow><mn>2</mn></msub><mn>55</mn><mo>−</mo><mfrac><mn>7</mn><mn>4</mn></mfrac></mrow><annotation encoding="application/x-tex">
    p_0\coloneqq\log_255-\frac74
</annotation></semantics></math></span></span></span> because it is stipulated that <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>f</mi><mrow><mo fence="true">(</mo><msub><mi mathvariant="normal">A</mi><mn>4</mn></msub><mo fence="true">)</mo></mrow><mo>=</mo><mn>440</mn></mrow><annotation encoding="application/x-tex">f\left(\mathrm A_4\right)=440</annotation></semantics></math></span></span>, which is standardized as ISO 16 and known as <a href="https://en.wikipedia.org/wiki/A440_(pitch_standard)" target="_blank" rel="external">A440</a>.</p>
<h2 data-label="0.6" id="why-frac-712">Why <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mn>7</mn><mn>12</mn></mfrac></mrow><annotation encoding="application/x-tex">\frac 7{12}</annotation></semantics></math></span></span></h2>
<p>People think if the ratio of two frequencies is a simple rational number, then the interval of the two notes is harmonic.</p>
<p><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mn>2</mn><mfrac><mn>7</mn><mn>12</mn></mfrac></msup><mo>≈</mo><mfrac><mn>3</mn><mn>2</mn></mfrac></mrow><annotation encoding="application/x-tex">2^\frac 7{12}\approx\frac32</annotation></semantics></math></span></span>, which is a simple ratio. Harmonic, huh.</p>
<p>(Finally, as is a notice, codes appearing above are <a href="https://alda.io/" target="_blank" rel="external">alda</a> codes, which are used to write music.)</p>]]></content><author><name>UlyssesZhan</name><email>ulysseszhan@gmail.com</email></author><category term="music" /><category term="music theory" /><category term="number sequence" /><category term="long paper" /><category term="abstract algebra" /><summary type="html"><![CDATA[This article explores the concept which I call the frequency assignment, which is a mapping from <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>N</mi></mrow><annotation encoding="application/x-tex">N</annotation></semantics></math></span></span> (the set of notes) to <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mi mathvariant="double-struck">R</mi><mo>+</mo></msup></mrow><annotation encoding="application/x-tex">\mathbb R^+</annotation></semantics></math></span></span> (the set of frequencies). Concepts such as octaves, intervals, and equal temperaments are introduced.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ulysseszh.github.io/assets/images/covers/2020-03-27-notes-frequency.png" /><media:content medium="image" url="https://ulysseszh.github.io/assets/images/covers/2020-03-27-notes-frequency.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry></feed>