Skip to content

Commit 1affd55

Browse files
authored
Merge pull request adafruit#290 from CedarGroveStudios/patch-3
Reduce distortion at higher volume levels
2 parents 91fea47 + 3116c9e commit 1affd55

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

CircuitPython_Essentials/CircuitPython_Audio_Out_Tone.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
length = 8000 // frequency
1414
sine_wave = array.array("H", [0] * length)
1515
for i in range(length):
16-
sine_wave[i] = int((1 + math.sin(math.pi * 2 * i / 18)) * tone_volume * (2 ** 15))
16+
sine_wave[i] = int((1 + math.sin(math.pi * 2 * i / length)) * tone_volume * (2 ** 15 - 1))
1717

1818
audio = audioio.AudioOut(board.A0)
1919
sine_wave_sample = audioio.RawSample(sine_wave)

0 commit comments

Comments
 (0)