Reduce distortion at higher volume levels
This commit is contained in:
parent
20f8794bdb
commit
3116c9edd5
1 changed files with 1 additions and 1 deletions
|
|
@ -13,7 +13,7 @@ frequency = 440 # Set this to the Hz of the tone you want to generate.
|
|||
length = 8000 // frequency
|
||||
sine_wave = array.array("H", [0] * length)
|
||||
for i in range(length):
|
||||
sine_wave[i] = int((1 + math.sin(math.pi * 2 * i / 18)) * tone_volume * (2 ** 15))
|
||||
sine_wave[i] = int((1 + math.sin(math.pi * 2 * i / length)) * tone_volume * (2 ** 15 - 1))
|
||||
|
||||
audio = audioio.AudioOut(board.A0)
|
||||
sine_wave_sample = audioio.RawSample(sine_wave)
|
||||
|
|
|
|||
Loading…
Reference in a new issue