Page 1 of 1

wav sounds with Arduino nano

Posted: Wed Feb 01, 2023 12:12 pm
by mola.ae
I tried many example with wav files, unfortunately I can't get the sound out,,,, please, I need example of any sound like mp3 or wav for Arduino nano or ATmega386. using normal SD card module with 4G card memory formatted in FAT. thanks a lot :|

Re: wav sounds with Arduino nano

Posted: Wed Feb 01, 2023 2:30 pm
by mnf
A board like the dfplayer is probably the easeist route?

Try https://uk.banggood.com/search/dfplayer.html?from=nav

It works very well - support is good and sound quality reasonable.

Martin

Re: wav sounds with Arduino nano

Posted: Wed Feb 01, 2023 6:03 pm
by mola.ae
Thanks, Martin
but i wana use normal sd card module, i found many applications in Arduino IDE. but I can't use it in flowcode. totally I need it
like this https://www.aliexpress.com/item/3287733 ... dPlD3KGwFL

Re: wav sounds with Arduino nano

Posted: Wed Feb 01, 2023 8:29 pm
by mnf
I did post a snippet of code here https://www.flowcode.co.uk/forums/viewt ... 6284#p6284 - although this read sound from an EEPROM chip - you might be able to get it to work from SD (speed is going to be an issue)

The Arduino doesn't have any sound generation hardware - so although it's possible (just) - it's not going to be an easy job. Adafruit used to do a shield that could do this https://www.adafruit.com/product/94 - it was quite expensive, and may no longer be available. It was also not as good as a dfplayer.

Do you have a link to an Arduino program that can do what you want?

Martin

Re: wav sounds with Arduino nano

Posted: Wed Feb 01, 2023 10:42 pm
by mola.ae
An easy code, with a few lines > playing reasonable wav sound ... like here https://www.instructables.com/Playing-W ... g-arduino/
actually, I did it, but the flowcode is my life :wink:

Re: wav sounds with Arduino nano

Posted: Wed Feb 01, 2023 11:08 pm
by mnf
Easy - but the tmrpcm library is doing a lot of the work..

It is how I did it as well, except no library - did you look at the above link - I used pin 11 for the output - this would need to be changed to pin 9 to allow the ad card to be read using hardware spi.

Try modifying my code and I'll try and help if you get stuck...

You also asked about mp3s - I don't think that is going to happen though!

Martin

Re: wav sounds with Arduino nano

Posted: Thu Feb 02, 2023 12:23 am
by mola.ae
I modified the formal example to be that in my drive>>> https://drive.google.com/file/d/1N58yfX ... share_link

it seems work fine in simulation after add the same wav file with specific conditions

Re: wav sounds with Arduino nano

Posted: Thu Feb 02, 2023 9:42 pm
by mnf
Thanks,

It looks good - a very neat solution - does it work on hardware or does the SD card speed limit it. I wasn't aware of the WavPlayerFAT component - but it looks a useful addition, and does the double buffering too.

Martin