forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Milestone
Description
This is also one of the problems that @urish encountered on #2337.
Reproducer:
import audiopwmio
import audiocore
import board
import digitalio
import time
values = {
'b': (-128, 127),
'B': (0, 255),
'h': (-32768, 32767),
'H': (0, 65535),
}
def go(at = 'h', channel_count = 1):
wave = array.array(at, [values[at][0]]) * channel_count * 24
for i in range(len(wave)//2, len(wave)):
wave[i] = values[at][1]
print(wave)
enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
enable.direction = digitalio.Direction.OUTPUT
enable.value = True
audio = audiopwmio.PWMAudioOut(board.SPEAKER)
wave_sample = audiocore.RawSample(wave, channel_count = channel_count)
audio.play(wave_sample, loop=True)
time.sleep(1)
audio.stop()
audio.deinit()
enable.deinit()
save as s8.py and import on a CPB at the REPL. s8.go(channel_count=1)
and s8.go(channel_count=2)
should play the same frequency, but they don't.
Metadata
Metadata
Assignees
Labels
No labels