Add pulse, noise, PWM slow, PWM fast audio demos

Every waveform on the synths page now has an audio player.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 16:04:13 -04:00
parent ead42751ef
commit 04d2de3e70
6 changed files with 36 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+20
View File
@@ -448,6 +448,22 @@ def gen_synth_acoustic_guitar():
p.strum(ch, Duration.WHOLE, velocity=75)
render("synth_acoustic_guitar", score)
def gen_synth_pulse():
_synth_demo("pulse", "pulse")
def gen_synth_noise():
score = Score("4/4", bpm=100)
p = score.part("demo", synth="noise", envelope="pad", volume=0.3,
lowpass=2000, reverb=0.3)
p.add("C4", Duration.WHOLE * 2, velocity=80)
render("synth_noise", score)
def gen_synth_pwm_slow():
_synth_demo("pwm_slow", "pwm_slow", envelope="pad")
def gen_synth_pwm_fast():
_synth_demo("pwm_fast", "pwm_fast")
def gen_synth_fm():
_synth_demo("fm", "fm", envelope="piano")
@@ -802,6 +818,10 @@ GENERATORS = [
gen_synth_saw,
gen_synth_triangle,
gen_synth_square,
gen_synth_pulse,
gen_synth_noise,
gen_synth_pwm_slow,
gen_synth_pwm_fast,
gen_synth_fm,
gen_synth_supersaw,
gen_synth_piano,
+16
View File
@@ -114,6 +114,10 @@ the classic NES-style buzzy tone.
lead = score.part("lead", synth="pulse", envelope="pluck")
.. raw:: html
<audio controls style="width:100%;margin:0.3em 0 0.5em"><source src="../_static/audio/synth_pulse.wav" type="audio/wav"></audio>
FM Synthesis
~~~~~~~~~~~~
@@ -162,6 +166,10 @@ Useful as a texture layer, a percussion source, or a wind/ocean effect.
lowpass=2000,
)
.. raw:: html
<audio controls style="width:100%;margin:0.3em 0 0.5em"><source src="../_static/audio/synth_noise.wav" type="audio/wav"></audio>
Ensemble Waveforms
------------------
@@ -219,6 +227,10 @@ from Boards of Canada to Drake? PWM with a slow LFO.
reverb=0.4,
)
.. raw:: html
<audio controls style="width:100%;margin:0.3em 0 0.5em"><source src="../_static/audio/synth_pwm_slow.wav" type="audio/wav"></audio>
PWM Fast
~~~~~~~~
@@ -231,6 +243,10 @@ produces a natural chorus/vibrato effect built into the waveform itself.
lead = score.part("lead", synth="pwm_fast", envelope="pluck", volume=0.5)
.. raw:: html
<audio controls style="width:100%;margin:0.3em 0 0.5em"><source src="../_static/audio/synth_pwm_fast.wav" type="audio/wav"></audio>
ADSR Envelopes
--------------