Skip to content

Commit

Permalink
Bump to latest updates
Browse files Browse the repository at this point in the history
  • Loading branch information
asigalov61 authored Sep 1, 2024
1 parent 82fcaf4 commit 08cd833
Showing 1 changed file with 58 additions and 22 deletions.
80 changes: 58 additions & 22 deletions docs/TMIDIX.html
Original file line number Diff line number Diff line change
Expand Up @@ -6072,22 +6072,24 @@ <h6 id="_25"></h6>

<span class="n">esn</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">enhanced_score_notes</span><span class="p">)</span>

<span class="n">prec</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">pe</span> <span class="o">=</span> <span class="n">enhanced_score_notes</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>

<span class="k">if</span> <span class="n">timings_divider</span> <span class="o">&gt;</span> <span class="mi">32</span><span class="p">:</span>
<span class="n">prec</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">abs_time</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">enhanced_score_notes</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">/</span> <span class="n">timings_divider</span><span class="p">)</span>

<span class="k">elif</span> <span class="n">timings_divider</span> <span class="o">&gt;</span> <span class="mi">128</span><span class="p">:</span>
<span class="n">prec</span> <span class="o">=</span> <span class="mi">2</span>

<span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">esn</span><span class="p">:</span>
<span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">e</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">esn</span><span class="p">):</span>

<span class="n">dtime</span> <span class="o">=</span> <span class="nb">int</span><span class="p">((</span><span class="n">e</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">/</span> <span class="n">timings_divider</span><span class="p">)</span> <span class="o">-</span> <span class="p">(</span><span class="n">pe</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">/</span> <span class="n">timings_divider</span><span class="p">))</span>

<span class="n">e</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">e</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">/</span> <span class="n">timings_divider</span><span class="p">)</span> <span class="o">+</span> <span class="n">timings_shift</span>
<span class="n">e</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">abs_time</span> <span class="o">+</span> <span class="n">timings_shift</span>

<span class="n">e</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="nb">int</span><span class="p">(</span><span class="n">e</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">/</span> <span class="n">timings_divider</span><span class="p">))</span> <span class="o">+</span> <span class="n">timings_shift</span>

<span class="n">e</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">=</span> <span class="n">e</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">+</span> <span class="n">pitch_shift</span>

<span class="n">abs_time</span> <span class="o">+=</span> <span class="n">dtime</span>

<span class="n">pe</span> <span class="o">=</span> <span class="n">enhanced_score_notes</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>

<span class="k">if</span> <span class="n">full_sorting</span><span class="p">:</span>

<span class="c1"># Sorting by patch, pitch, then by start-time</span>
Expand Down Expand Up @@ -9673,6 +9675,26 @@ <h6 id="_25"></h6>

<span class="c1">###################################################################################</span>

<span class="k">def</span> <span class="nf">escore_notes_delta_times</span><span class="p">(</span><span class="n">escore_notes</span><span class="p">,</span>
<span class="n">timings_index</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
<span class="n">channels_index</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span>
<span class="n">omit_zeros</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">omit_drums</span><span class="o">=</span><span class="kc">False</span>
<span class="p">):</span>

<span class="k">if</span> <span class="n">omit_drums</span><span class="p">:</span>

<span class="n">score</span> <span class="o">=</span> <span class="p">[</span><span class="n">e</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">escore_notes</span> <span class="k">if</span> <span class="n">e</span><span class="p">[</span><span class="n">channels_index</span><span class="p">]</span> <span class="o">!=</span> <span class="mi">9</span><span class="p">]</span>
<span class="n">dtimes</span> <span class="o">=</span> <span class="p">[</span><span class="n">score</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">timings_index</span><span class="p">]]</span> <span class="o">+</span> <span class="p">[</span><span class="n">b</span><span class="p">[</span><span class="n">timings_index</span><span class="p">]</span><span class="o">-</span><span class="n">a</span><span class="p">[</span><span class="n">timings_index</span><span class="p">]</span> <span class="k">for</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">score</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="n">score</span><span class="p">[</span><span class="mi">1</span><span class="p">:])]</span>

<span class="k">else</span><span class="p">:</span>
<span class="n">dtimes</span> <span class="o">=</span> <span class="p">[</span><span class="n">escore_notes</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">timings_index</span><span class="p">]]</span> <span class="o">+</span> <span class="p">[</span><span class="n">b</span><span class="p">[</span><span class="n">timings_index</span><span class="p">]</span><span class="o">-</span><span class="n">a</span><span class="p">[</span><span class="n">timings_index</span><span class="p">]</span> <span class="k">for</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">escore_notes</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="n">escore_notes</span><span class="p">[</span><span class="mi">1</span><span class="p">:])]</span>

<span class="k">if</span> <span class="n">omit_zeros</span><span class="p">:</span>
<span class="n">dtimes</span> <span class="o">=</span> <span class="p">[</span><span class="n">d</span> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">dtimes</span> <span class="k">if</span> <span class="n">d</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">]</span>

<span class="k">return</span> <span class="n">dtimes</span>

<span class="c1"># This is the end of the TMIDI X Python module</span>

<span class="c1">###################################################################################</span>
Expand Down Expand Up @@ -13682,22 +13704,24 @@ <h2 class="section-title" id="header-functions">Functions</h2>

<span class="n">esn</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">enhanced_score_notes</span><span class="p">)</span>

<span class="n">prec</span> <span class="o">=</span> <span class="mi">0</span>

<span class="k">if</span> <span class="n">timings_divider</span> <span class="o">&gt;</span> <span class="mi">32</span><span class="p">:</span>
<span class="n">prec</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">pe</span> <span class="o">=</span> <span class="n">enhanced_score_notes</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>

<span class="k">elif</span> <span class="n">timings_divider</span> <span class="o">&gt;</span> <span class="mi">128</span><span class="p">:</span>
<span class="n">prec</span> <span class="o">=</span> <span class="mi">2</span>
<span class="n">abs_time</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">enhanced_score_notes</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">/</span> <span class="n">timings_divider</span><span class="p">)</span>

<span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">esn</span><span class="p">:</span>
<span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">e</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">esn</span><span class="p">):</span>

<span class="n">dtime</span> <span class="o">=</span> <span class="nb">int</span><span class="p">((</span><span class="n">e</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">/</span> <span class="n">timings_divider</span><span class="p">)</span> <span class="o">-</span> <span class="p">(</span><span class="n">pe</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">/</span> <span class="n">timings_divider</span><span class="p">))</span>

<span class="n">e</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">e</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">/</span> <span class="n">timings_divider</span><span class="p">)</span> <span class="o">+</span> <span class="n">timings_shift</span>
<span class="n">e</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">abs_time</span> <span class="o">+</span> <span class="n">timings_shift</span>

<span class="n">e</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="nb">int</span><span class="p">(</span><span class="n">e</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">/</span> <span class="n">timings_divider</span><span class="p">))</span> <span class="o">+</span> <span class="n">timings_shift</span>

<span class="n">e</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">=</span> <span class="n">e</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">+</span> <span class="n">pitch_shift</span>

<span class="n">abs_time</span> <span class="o">+=</span> <span class="n">dtime</span>

<span class="n">pe</span> <span class="o">=</span> <span class="n">enhanced_score_notes</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>

<span class="k">if</span> <span class="n">full_sorting</span><span class="p">:</span>

<span class="c1"># Sorting by patch, pitch, then by start-time</span>
Expand Down Expand Up @@ -15315,7 +15339,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>

<div class="item">
<div class="name def" id="TMIDIX.escore_notes_delta_times">
<p>def <span class="ident">escore_notes_delta_times</span>(</p><p>escore_notes, times_index=1)</p>
<p>def <span class="ident">escore_notes_delta_times</span>(</p><p>escore_notes, timings_index=1, channels_index=3, omit_zeros=False, omit_drums=False)</p>
</div>


Expand All @@ -15324,13 +15348,25 @@ <h2 class="section-title" id="header-functions">Functions</h2>
<div class="source_cont">
<p class="source_link"><a href="javascript:void(0);" onclick="toggle('source-TMIDIX.escore_notes_delta_times', this);">Show source &equiv;</a></p>
<div id="source-TMIDIX.escore_notes_delta_times" class="source">
<div class="codehilite"><pre><span></span><span class="k">def</span> <span class="nf">escore_notes_delta_times</span><span class="p">(</span><span class="n">escore_notes</span><span class="p">,</span>
<span class="n">times_index</span><span class="o">=</span><span class="mi">1</span>
<span class="p">):</span>
<div class="codehilite"><pre><span></span><span class="k">def</span> <span class="nf">escore_notes_delta_times</span><span class="p">(</span><span class="n">escore_notes</span><span class="p">,</span>
<span class="n">timings_index</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
<span class="n">channels_index</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span>
<span class="n">omit_zeros</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">omit_drums</span><span class="o">=</span><span class="kc">False</span>
<span class="p">):</span>

<span class="n">descore_notes</span> <span class="o">=</span> <span class="n">delta_score_notes</span><span class="p">(</span><span class="n">escore_notes</span><span class="p">)</span>
<span class="k">if</span> <span class="n">omit_drums</span><span class="p">:</span>

<span class="k">return</span> <span class="p">[</span><span class="n">e</span><span class="p">[</span><span class="n">times_index</span><span class="p">]</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">descore_notes</span><span class="p">]</span>
<span class="n">score</span> <span class="o">=</span> <span class="p">[</span><span class="n">e</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">escore_notes</span> <span class="k">if</span> <span class="n">e</span><span class="p">[</span><span class="n">channels_index</span><span class="p">]</span> <span class="o">!=</span> <span class="mi">9</span><span class="p">]</span>
<span class="n">dtimes</span> <span class="o">=</span> <span class="p">[</span><span class="n">score</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">timings_index</span><span class="p">]]</span> <span class="o">+</span> <span class="p">[</span><span class="n">b</span><span class="p">[</span><span class="n">timings_index</span><span class="p">]</span><span class="o">-</span><span class="n">a</span><span class="p">[</span><span class="n">timings_index</span><span class="p">]</span> <span class="k">for</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">score</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="n">score</span><span class="p">[</span><span class="mi">1</span><span class="p">:])]</span>

<span class="k">else</span><span class="p">:</span>
<span class="n">dtimes</span> <span class="o">=</span> <span class="p">[</span><span class="n">escore_notes</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">timings_index</span><span class="p">]]</span> <span class="o">+</span> <span class="p">[</span><span class="n">b</span><span class="p">[</span><span class="n">timings_index</span><span class="p">]</span><span class="o">-</span><span class="n">a</span><span class="p">[</span><span class="n">timings_index</span><span class="p">]</span> <span class="k">for</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">escore_notes</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="n">escore_notes</span><span class="p">[</span><span class="mi">1</span><span class="p">:])]</span>

<span class="k">if</span> <span class="n">omit_zeros</span><span class="p">:</span>
<span class="n">dtimes</span> <span class="o">=</span> <span class="p">[</span><span class="n">d</span> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">dtimes</span> <span class="k">if</span> <span class="n">d</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">]</span>

<span class="k">return</span> <span class="n">dtimes</span>
</pre></div>

</div>
Expand Down

0 comments on commit 08cd833

Please sign in to comment.