I have try wave.py from AMP skin tutorial on my nucleoL476 board (http://docs.micropython.org/en/latest/p ... _skin.html)
but I get some errors, maybe is something changed in interpreter.
First my maybe good solved error is change from _collections to ucollections ... maybe is ok but after
command >>>f = wave.open('test.wav')
I get error AttributeError: 'module' object has no attribute 'open'
???? can anybody confirm if wave player working?
WAV player
Re: WAV player
What does your import statement look like?
It should just be: import wave
It should just be: import wave
Re: WAV player
>>> import wave
>>> from pyb import DAC
>>> dac = DAC(1)
>>> f = wave.open('test.wav')
>>> dac.write_timed(f.readframes(f.getnframes()), f.getframerate())
>>> from pyb import DAC
>>> dac = DAC(1)
>>> f = wave.open('test.wav')
>>> dac.write_timed(f.readframes(f.getnframes()), f.getframerate())
Re: WAV player
It works for me:
If I had to guess I would say that your wave.py file is corrupted.
Code: Select all
MicroPython v1.8.2-19-gc3f519a-dirty on 2016-07-18; PYBv1.0 with STM32F405RG
Type "help()" for more information.
>>>
>>> import wave
>>> f = wave.open('test.wav')
>>>
Re: WAV player
I had the same issue related to 'import wave' when testing my new AMP skin. It was due to the namedtuple import in wave.py. If you change line 89 of wave.py to:
from ucollections import namedtuple
the 'import wave' should work correctly.
You may need to define volume() and set it to volume(127) before trying
f = wave.open('test.wav')
dac.write_timed(f.readframes(f.getnframes()), f.getframerate())
-Chris Workman
from ucollections import namedtuple
the 'import wave' should work correctly.
You may need to define volume() and set it to volume(127) before trying
f = wave.open('test.wav')
dac.write_timed(f.readframes(f.getnframes()), f.getframerate())
-Chris Workman
-
- Posts: 10
- Joined: Sun Apr 30, 2017 8:52 pm
Re: WAV player
I have the same problem. Made the change on line 89 from:
from _collections import namedtuple
to:
from ucollections import namedtuple
I still get the error message: AttributeError: 'module' object has no attribute 'open'
from _collections import namedtuple
to:
from ucollections import namedtuple
I still get the error message: AttributeError: 'module' object has no attribute 'open'