strange behavior playing wave file

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
Frank_Muenzner
Posts: 3
Joined: Mon Nov 23, 2015 5:18 pm

strange behavior playing wave file

Post by Frank_Muenzner » Mon Nov 30, 2015 8:50 am

Hi,
I did some test with a modified example for AMP audio skin.
The same wave file as in AMP Audio skin are used.

If i try a at command line all is working fine.
but if the saqme commands are saved in file (play.py) and this file is executed it only works first time.

If this sequence of commands are executed at command line also more than one time all is working fine.

Play.py:
-------------------------------------------------------------
import wave
from pyb import DAC

dac = DAC(1)
f = wave.open('test.wav')
f.setpos(0)
dac.write_timed(f.readframes(f.getnframes()), f.getframerate())
f.close()
------------------------------------------------------------------

After second execfile("Play.py") execution all LEDs are switched on (Sequence: red -> red+green -> red+green+yellow -> red+green+yellow +blue -> green+yellow +blue -> yellow +blue -> blue) the micropython board seem to crash.

Why is the behavior from sequence execution by commandline other than by execfile?
Any ways known to solve it?


Best regards,
Frank

Post Reply