Browse Source

Synthesizer

pull/167/head
Jure Šorn 1 year ago
parent
commit
622e6ab0ae
2 changed files with 4 additions and 5 deletions
  1. 3
      README.md
  2. 6
      index.html

3
README.md

@ -2966,8 +2966,7 @@ parse_note = lambda note: (get_hz(note[:2]), 1/4 if '♩' in note else 1/8)
get_samples = lambda note: get_wave(*parse_note(note)) if note else get_pause(1/8)
samples_f = it.chain.from_iterable(get_samples(n) for n in f'{P1},{P1},{P2}'.split(','))
samples_i = array.array('h', (int(f * 30000) for f in samples_f))
player = simpleaudio.play_buffer(samples_i, 1, 2, F)
player.wait_done()
simpleaudio.play_buffer(samples_i, 1, 2, F).wait_done()
```

6
index.html

@ -54,7 +54,7 @@
<body>
<header>
<aside>August 24, 2023</aside>
<aside>August 31, 2023</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</header>
@ -2424,7 +2424,7 @@ parse_note = <span class="hljs-keyword">lambda</span> note: (get_hz(note[:<span
get_samples = <span class="hljs-keyword">lambda</span> note: get_wave(*parse_note(note)) <span class="hljs-keyword">if</span> note <span class="hljs-keyword">else</span> get_pause(<span class="hljs-number">1</span>/<span class="hljs-number">8</span>)
samples_f = it.chain.from_iterable(get_samples(n) <span class="hljs-keyword">for</span> n <span class="hljs-keyword">in</span> <span class="hljs-string">f'<span class="hljs-subst">{P1}</span>,<span class="hljs-subst">{P1}</span>,<span class="hljs-subst">{P2}</span>'</span>.split(<span class="hljs-string">','</span>))
samples_i = array.array(<span class="hljs-string">'h'</span>, (int(f * <span class="hljs-number">30000</span>) <span class="hljs-keyword">for</span> f <span class="hljs-keyword">in</span> samples_f))
simpleaudio.play_buffer(samples_i, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, F)
simpleaudio.play_buffer(samples_i, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, F).wait_done()
</code></pre></div></div>
@ -2928,7 +2928,7 @@ $ deactivate <span class="hljs-comment"># Deactivates the activ
<footer>
<aside>August 24, 2023</aside>
<aside>August 31, 2023</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</footer>

Loading…
Cancel
Save