Skip to content

Commit ed682e5

Browse files
authored
Fix bug where high pitch CV would cause the sample rate to be too high. (#7)
1 parent 939d5bc commit ed682e5

File tree

1 file changed

+2
-1
lines changed
  • firmware/winterbloom_bhb

1 file changed

+2
-1
lines changed

firmware/winterbloom_bhb/bhb.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ def load_sample(self, path):
134134

135135
def play(self, sample, pitch_cv=None, loop=False):
136136
if pitch_cv is not None:
137-
sample.sample_rate = int(44100 * pow(2, pitch_cv))
137+
sample_rate = min(int(44100 * pow(2, pitch_cv)), (350000 - 1))
138+
sample.sample_rate = sample_rate
138139
self.audio_out.stop()
139140
self.audio_out.play(sample, loop=loop)
140141

0 commit comments

Comments
 (0)