sipeed / MaixPy-v1_scripts

micropython scripts for MaixPy
https://maixpy.sipeed.com
MIT License
626 stars 431 forks source link

speaker sample #2

Open mhama opened 5 years ago

mhama commented 5 years ago

It would be better to have some samples to use the speaker, as Maix Go have a good-looking speaker hardware.

Neutree commented 5 years ago

https://github.com/sipeed/MaixPy_scripts/blob/master/multimedia/audio/play_wav.py

https://maixpy.sipeed.com/zh/libs/Maix/i2s.html

https://maixpy.sipeed.com/zh/libs/Maix/audio.html

linycm commented 5 years ago

I test play_wav.py and got the below error. Pls advise. thanks!

wav_info = player.play_process(wav_dev)

[MAIXPY]: wav error code : 7 Traceback (most recent call last): File "", line 1, in OSError: wav init error

And for player.volume(40), I got error: Traceback (most recent call last): File "", line 1, in AttributeError: 'AUDIO' object has no attribute 'volume'

Neutree commented 5 years ago

@linycm wait for the new release or build yourself firmware

linycm commented 5 years ago

@Neutree I build firmware again but still got error when

wav_info = player.play_process(wav_dev) [MAIXPY]: wav error code : 7 Traceback (most recent call last): File "", line 1, in OSError: wav init error

core dump: fault store Cause 0x0000000000000007, EPC 0x00000000800c2a44 .......

Neutree commented 5 years ago

@linycm The header of wav file you used have some problem, please send me your wav file, so I can check the header, or just convert to wav file maixpy support. here for example

linycm commented 5 years ago

radio.wav.tar.gz

@Neutree pls help to check. thanks!

Neutree commented 5 years ago

@linycm This audio file uses ADPCM encoding. MaixPy only supports PCM 16bit little endian encoding. Please find a way to convert to such a format. There is no plan to support ADPCM.

image

MaixPy support like this one:

image