Skip to content

Commit

Permalink
pianoroll correction & changes (sonification duration should be given…
Browse files Browse the repository at this point in the history
… in seconds)
  • Loading branch information
yiitozer committed Mar 12, 2024
1 parent 2f541b4 commit f5d64fd
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 61 deletions.
Binary file modified docs/build/doctrees/core/pianoroll.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/environment.pickle
Binary file not shown.
4 changes: 3 additions & 1 deletion docs/build/html/_modules/libsoni/core/methods.html
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,9 @@ <h1>Source code for libsoni.core.methods</h1><div class="highlight"><pre>
<span class="k">assert</span> <span class="mi">0</span> <span class="o">&lt;=</span> <span class="n">pitch</span> <span class="o">&lt;=</span> <span class="mi">127</span><span class="p">,</span> <span class="sa">f</span><span class="s1">&#39;Pitch is out of range [0,127].&#39;</span>

<span class="n">pitch_frequency</span> <span class="o">=</span> <span class="n">pitch_to_frequency</span><span class="p">(</span><span class="n">pitch</span><span class="o">=</span><span class="n">pitch</span><span class="p">,</span> <span class="n">tuning_frequency</span><span class="o">=</span><span class="n">tuning_frequency</span><span class="p">)</span>
<span class="n">generated_tone</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="mi">2</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">*</span> <span class="n">pitch_frequency</span> <span class="o">*</span> <span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">duration</span> <span class="o">*</span> <span class="n">fs</span><span class="p">)))</span> <span class="o">/</span> <span class="n">fs</span> <span class="o">+</span> <span class="n">modulation_amplitude</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="mi">2</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">*</span> <span class="n">pitch_frequency</span> <span class="o">*</span> <span class="n">modulation_rate_relative</span> <span class="o">*</span> <span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">duration</span> <span class="o">*</span> <span class="n">fs</span><span class="p">)))))</span>
<span class="n">generated_tone</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="mi">2</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">*</span> <span class="n">pitch_frequency</span> <span class="o">*</span> <span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">duration</span> <span class="o">*</span> <span class="n">fs</span><span class="p">)))</span> <span class="o">/</span> <span class="n">fs</span> <span class="o">+</span>
<span class="n">modulation_amplitude</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="mi">2</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span> <span class="o">*</span> <span class="n">pitch_frequency</span> <span class="o">*</span> <span class="n">modulation_rate_relative</span> <span class="o">*</span>
<span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">duration</span> <span class="o">*</span> <span class="n">fs</span><span class="p">)))))</span>
<span class="n">generated_tone</span> <span class="o">=</span> <span class="n">gain</span> <span class="o">*</span> <span class="n">fade_signal</span><span class="p">(</span><span class="n">signal</span><span class="o">=</span><span class="n">generated_tone</span><span class="p">,</span> <span class="n">fs</span><span class="o">=</span><span class="n">fs</span><span class="p">,</span> <span class="n">fading_duration</span><span class="o">=</span><span class="n">fading_duration</span><span class="p">)</span>

<span class="k">return</span> <span class="n">generated_tone</span></div>
Expand Down
Loading

0 comments on commit f5d64fd

Please sign in to comment.