Go Down

Topic: How can I play audio in external speakers (with minijack) (Read 223 times) previous topic - next topic

7A15

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?
https://s.click.aliexpress.com/e/b2PqsXUG
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

Luis

Grumpy_Mike

Quote
Is there any way to do that?
Yes.

Quote
Is it just necessary to put a mini Jack connector where there are the two pins that I mentioned earlier?
Yes.

Quote
Is there a problem with the maximum volume of the sound an the amperage?
No.

Quote
Is it necessary or can I use a shield for that?
If you can find a shield then use it, but there is no need.

Quote
By the way I found this shield but I don't know how to use it?
So don't use it. It would seem that it duplicates a lot of what you have already.

Quote
PD: there are some time that I need to play two sounds at the same time
Then you will need another sort of sound player, you can't do that with what you have.
 

DVDdoug

Quote
Is it necessary or can I use a shield for that?
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.

Quote
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.

7A15

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.

Thanks again.
Luis.

Go Up