Assuming around 30KB of storage, at a 8KHz sampling frequency it gives around 3.5 seconds of recording sound.
Here is a sample code to play the attached files. They are based on the sound at https://www.freesound.org/people/urupin/sounds/199905/ , which has a CC0 license.
Code: Select all
import audio
def read_frame(f_list, frame):
for file in f_list:
ln = file.readinto(frame)
while ln:
yield frame
ln = file.readinto(frame)
def play_file(f):
with open(f + "-01.raw", "rb") as file1, \
open(f + "-02.raw", "rb") as file2, \
open(f + "-03.raw", "rb") as file3, \
open(f + "-04.raw", "rb") as file4:
f_list = [file1, file2, file3, file4]
audio.play(read_frame(f_list, frame), wait=True)
# Allocate memory outside the interrupt
frame = audio.AudioFrame()
ln = -1
file = 1
# play the files
play_file("robot")