MemoryError when read wave frames
Posted: Tue Jun 05, 2018 11:04 pm
Hi,
when using openMV DAC to play wav file, MemoryError exception is raised in chunk.py when readframes function in wave.py module is called.
I got the chunk.py and wave.py and test wav file from below article:
https://docs.micropython.org/en/latest/ ... _skin.html
the tested wave file is near 9KB, 8-bit, 16KHZ.
def play(filename):
f = wave.open(filename, 'r')
total_frames = f.getnframes()
framerate = f.getframerate()
for position in range(0, total_frames, framerate):
f.setpos(position)
dac.write_timed(f.readframes(framerate), framerate)
delay(1000)
Is this MemoryError due to limited heap size? how to check how much heap available? the tested wav file is less than 9kB.
is there anyone succeed in play wav file with openMV?
Thanks,
when using openMV DAC to play wav file, MemoryError exception is raised in chunk.py when readframes function in wave.py module is called.
I got the chunk.py and wave.py and test wav file from below article:
https://docs.micropython.org/en/latest/ ... _skin.html
the tested wave file is near 9KB, 8-bit, 16KHZ.
def play(filename):
f = wave.open(filename, 'r')
total_frames = f.getnframes()
framerate = f.getframerate()
for position in range(0, total_frames, framerate):
f.setpos(position)
dac.write_timed(f.readframes(framerate), framerate)
delay(1000)
Is this MemoryError due to limited heap size? how to check how much heap available? the tested wav file is less than 9kB.
is there anyone succeed in play wav file with openMV?
Thanks,