From 90571e7b7f773e0bedbb69617101f67be4128a9e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 27 May 2020 16:43:35 -0500 Subject: [PATCH] Various doc examples: Fix the "/ 18" copypasta bug --- shared-bindings/audiobusio/I2SOut.c | 2 +- shared-bindings/audiocore/RawSample.c | 2 +- shared-bindings/audioio/AudioOut.c | 2 +- shared-bindings/audiopwmio/PWMAudioOut.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shared-bindings/audiobusio/I2SOut.c b/shared-bindings/audiobusio/I2SOut.c index d965aac89e..fd71a6e852 100644 --- a/shared-bindings/audiobusio/I2SOut.c +++ b/shared-bindings/audiobusio/I2SOut.c @@ -61,7 +61,7 @@ //| length = 8000 // 440 //| sine_wave = array.array("H", [0] * length) //| for i in range(length): -//| sine_wave[i] = int(math.sin(math.pi * 2 * i / 18) * (2 ** 15) + 2 ** 15) +//| sine_wave[i] = int(math.sin(math.pi * 2 * i / length) * (2 ** 15) + 2 ** 15) //| //| sine_wave = audiocore.RawSample(sine_wave, sample_rate=8000) //| i2s = audiobusio.I2SOut(board.D1, board.D0, board.D9) diff --git a/shared-bindings/audiocore/RawSample.c b/shared-bindings/audiocore/RawSample.c index c0f9325e67..2eadf1fab4 100644 --- a/shared-bindings/audiocore/RawSample.c +++ b/shared-bindings/audiocore/RawSample.c @@ -61,7 +61,7 @@ //| length = 8000 // 440 //| sine_wave = array.array("h", [0] * length) //| for i in range(length): -//| sine_wave[i] = int(math.sin(math.pi * 2 * i / 18) * (2 ** 15)) +//| sine_wave[i] = int(math.sin(math.pi * 2 * i / length) * (2 ** 15)) //| //| dac = audioio.AudioOut(board.SPEAKER) //| sine_wave = audiocore.RawSample(sine_wave) diff --git a/shared-bindings/audioio/AudioOut.c b/shared-bindings/audioio/AudioOut.c index 5748682020..9ba72bd41d 100644 --- a/shared-bindings/audioio/AudioOut.c +++ b/shared-bindings/audioio/AudioOut.c @@ -61,7 +61,7 @@ //| length = 8000 // 440 //| sine_wave = array.array("H", [0] * length) //| for i in range(length): -//| sine_wave[i] = int(math.sin(math.pi * 2 * i / 18) * (2 ** 15) + 2 ** 15) +//| sine_wave[i] = int(math.sin(math.pi * 2 * i / length) * (2 ** 15) + 2 ** 15) //| //| dac = audioio.AudioOut(board.SPEAKER) //| sine_wave = audiocore.RawSample(sine_wave, sample_rate=8000) diff --git a/shared-bindings/audiopwmio/PWMAudioOut.c b/shared-bindings/audiopwmio/PWMAudioOut.c index d6b102317f..812b7330d4 100644 --- a/shared-bindings/audiopwmio/PWMAudioOut.c +++ b/shared-bindings/audiopwmio/PWMAudioOut.c @@ -63,7 +63,7 @@ //| length = 8000 // 440 //| sine_wave = array.array("H", [0] * length) //| for i in range(length): -//| sine_wave[i] = int(math.sin(math.pi * 2 * i / 18) * (2 ** 15) + 2 ** 15) +//| sine_wave[i] = int(math.sin(math.pi * 2 * i / length) * (2 ** 15) + 2 ** 15) //| //| dac = audiopwmio.PWMAudioOut(board.SPEAKER) //| sine_wave = audiocore.RawSample(sine_wave, sample_rate=8000)