Playing wav files from sd card.



  • By using the built in wav_player (firmware 1.5 and above) I can play wav files pretty easily. However, when I play them from the sd card this causes a lot of stutter. So far I have tried three different SD cards with the same results. I have used the mix.wav found in the res directory and put it on my SD card and run this code.

    from wav import *
    
    wav_player.playWav('res/mix.wav')
    wav_player.playWav('/sd/mix.wav')
    

    The one played from the memory plays fluently without issues. The one from the SD card stutters and does not run fluently.

    Anyone has an idea on how to solve this?



  • You can try this guide I made some time ago https://www.hackster.io/lukasmaximus89/play-wav-files-on-your-m5stack-3bee7e I think the code should only be compatible with older versions of the firmware, I haven't tested it recently



  • @lukasmaximus Hey lukas, on which firmware version did you make this run?

    I am running it on a M5Core Basic and the unit reboots after the .wav was played once and I hit the button again.

    I have to uncomment:
    uos.sdconfig(uos.SDMODE_SPI,clk=18,mosi=23,miso=19,cs=4)

    to avoid another error

    still I get the:
    "sd card not mounted" lcd print.

    Is there any chance to adapt this patch to a newer firmware version?

    I have also tried it on a Core2, but it doesn't seem to know any of the I2C modes which you defined.

    would be great to get this to work again and make/update custom uiflow blocks.

    Thanks in advance for your reply