Very Bad Sound
Topic: Very Bad Sound
(Read 150 times)
Anyting isn't impossible
Very Bad Sound
Sep 15, 2017, 06:31 pm
I tried play music with arduino uno and 8-ohm speaker but there were bad sound.Because of arduino uno doesn't have internal Digital to Analog Converter.How to make external Digital to Analog Converter.If you know it,please reply how to make
Re: Very Bad Sound
Sep 15, 2017, 07:23 pm
: Sep 15, 2017, 07:36 pm by DVDdoug
How are you doing it now?
Where is the "sound" coming from? (A WAV file on an SD card, or generated in software, etc.?)
The most common solution is an
. The audio shield will have a DAC, it's own clock, an SD card slot, and firmware to read the file(s) and play audio. Some of them have an MP3 decoder built-in. (The Arduino just has to send some simple "control signals".)
Some people apparently get good results with the TMRpcm library. Some people complain of noise. (I haven't tried it.)
You can also make an 8-bit
R-2R resistor DAC
, which is cheap & easy if 8-bit quality is good enough for you. Be sure to "bias" your audio data (if it's not already) because the Arduino can't put-out the negative-half of the waveform. (A series capacitor will block the DC bias component, giving you a signal that actually goes negative.)
The tone() function will generate a pure-clean square-wave, but that's just one tone at a time with no dynamics or volume variation and it doesn't sound natural, and it's nothing like playing a WAV or MP3 file.
and 8-ohm speaker
Do NOT connect a speaker directly to the Arudino!
impedance/resistance load on an Arduino output pin is
(for the "absoulute maximum" current rating of 40mA). Anything less than 125 Ohms is drawing excess current, possibly damaging/frying your Arduino or causing unpredictable problems. Piezo transducers are higher impedance and OK.
audio shields can drive headphones (typically 32-64 Ohms) and some
be able to drive speaker. But generally,
you need an amplifier to drive a speaker
(which you can make or buy), or you can use regular "powered" computer speakers. (Hi-Fi & home theater speakers also need an amplifier, except for subwoofers which are usually active/powered.)