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:
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,
This is just a fragmented memory issue, the scripts run fine on H7. I think most of memory is consumed by just loading/parsing/compiling the modules wave and chunk.
This seems to fix it:
frames = f.readframes(frame_rate)
self.dac.write_timed(frames, frame_rate)
del frames
delay(1000)
gc.collect()