wav sounds with Arduino nano

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
mola.ae
Posts: 6
Joined: Thu Sep 23, 2021 12:38 pm
Been thanked: 2 times
Contact:

wav sounds with Arduino nano

Post 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 :|

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: wav sounds with Arduino nano

Post 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

mola.ae
Posts: 6
Joined: Thu Sep 23, 2021 12:38 pm
Been thanked: 2 times
Contact:

Re: wav sounds with Arduino nano

Post 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

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: wav sounds with Arduino nano

Post 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

mola.ae
Posts: 6
Joined: Thu Sep 23, 2021 12:38 pm
Been thanked: 2 times
Contact:

Re: wav sounds with Arduino nano

Post 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:

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: wav sounds with Arduino nano

Post 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

mola.ae
Posts: 6
Joined: Thu Sep 23, 2021 12:38 pm
Been thanked: 2 times
Contact:

Re: wav sounds with Arduino nano

Post 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

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: wav sounds with Arduino nano

Post 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

Post Reply