I'm doing a game where I need to play audio (MP3 or WAV), and I've found a lot of examples using a buzzer or a 2 pin speaker, but I want connect it to external speakers thru mini Jack (like PC external speakers, or home theater), but I've found nothing about that. Is there any way to do that? Is it just necessary to put a mini Jack connector where there are the two pins that I mentioned earlier? Is there a problem with the maximum volume of the sound an the amperage?
Is it necessary or can I use a shield for that? By the way I found this shield but I don't know how to use it? Anybody knows how can it be used?
Finally, do you know about some example online that I can see?
Can someone point me in the right direction?
Thanks a lot in advance.
PD: there are some time that I need to play two sounds at the same time
For "good quality" sound yes. Otherwise you can use tone()There is a software library called TMRpcm that can play files from an SDcard.
If you are using TMRpcm or tone() you can connect your amplifier or powered speakers to whatever I/O pin(s) the software is using, and connect the grounds. If you don't know how to solder a mating connector you can cut one end off of an audio cable. It's a good idea to add a series capacitor to blodk the DC that comes-out of the Arduino (0.1uF usually works fine).
If you are using an audio shield, just plug it in with an appropriate cable/adapter.
PD: there are some time that I need to play two sounds at the same time
I don't know of any way to do that with an Arduino. You could do it with two audio shields and a simple passive mixer. Even with a computer it would take special/custom software, or you'd have to run two media player applications at the same time.
Thanks for your answers. The TMRpcm library looks good, I will try it. Also it could be useful to play two audios at the same time (One in the background and one over it). As the documentation says:
Asynchronous Playback: Allows code in main loop to run while audio playback occurs.