Skip to content

Commit 6d29ca8

Browse files
authored
Add a burst generator example (#2)
1 parent 3169dd5 commit 6d29ca8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

examples/honk_burst.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""This example turns a Winterbloom Big Honking Button into a simple
2+
burst generator (that also happens to honk)
3+
"""
4+
import time
5+
6+
import winterbloom_bhb
7+
8+
bhb = winterbloom_bhb.BigHonkingButton()
9+
sample = bhb.load_sample("samples/honk.wav")
10+
burst_intervals = [0.05, 0.05, 0.05, 0.05, 0.1]
11+
12+
while True:
13+
if bhb.triggered:
14+
for interval in burst_intervals:
15+
bhb.gate_out = True
16+
bhb.play(sample, pitch_cv=bhb.pitch_in)
17+
time.sleep(interval)
18+
bhb.gate_out = False
19+
bhb.stop()
20+
time.sleep(interval)

0 commit comments

Comments
 (0)