I want to make an Arduino MKRZero play an audio file (e.g. wav) from a SD Card and send the audio signal on a 6.35mm mono jack socket, so that I can play the file on a guitar speaker (with its own power supply). So no need to drive a speaker.
I am sending the audio signal from the Arduino using the function analogWrite() on the digital pin D0. However, I considered another option, which is sending data over SPI to a DAC, e.g. DAC7742. What would be the advantages of using a DAC over SPI rather than Analogwrite directly to the jack socket like here? Speed? Sound quality?
Before I order the components, do you see any missing hardware/components or error between the Arduino and the audio signal in output (J3) so that I can connect to a guitar amplifier?
The built-in DAC is only 10-bits but that may be OK for "guitar quality". I would try that first, since it's easier.
I don't have any experience with 10-bit audio but with 8-bits you can hear quantization noise, which is a slight "fuzz" on top of the audio. Like regular noise it's most-noticeable with quiet sounds, but unlike regular analog noise it goes-away completely with silence.
As you may know, CDs are 16-bits.44.1kHz which is generally better than human hearing.
You shouldn't need any amplification. And, the LM386 is a (small) "power amplifier", designed to drive a speaker. It's not intended as a preamp.
You do need a "DC blocking capacitor" because the microcontroller can't put-out the negative half of the AC audio signal and it will have a DC bias.
And you probably don't need the volume control since your guitar amp probably already has one. But if you leave out the pot you should have a resistor to ground, which along with the capacitor makes a high pass filter. (DC is "zero Hz" and it's blocked by a high-pass filter).
@anon57585045 : Good question, that was one of the things I was not sure about. I'm not good at electronics, I'm more a SW guy, so I assumed that it could be necessary to have a "louder" audio signal (with a higher voltage), so that the signal reaching the amp is not too quiet. But I guess I was wrong! I will delete the AOP block then!
I will use the 10-bits DAC from pin A0!
@DVDdoug : I redid the diagram (much simpler now), hopefully I correctly placed the DC blocking capacitor. I looked up how to calculate its value, but I have no idea about the input impedance of the circuit to which this capacitor is connected or the frequency of the signal. Do you have any idea what would be the Capacitor value?
Also, I might have connect this "device" (my project is a pedal) to a mixing table which could be 10 meters from me, that's why I want the possibility of changing the volume from the pedal itself. But thank you for letting me know that I should have a high-pass filter if I decided to remove the volume control!
Thanks @DVDdoug , you're right, my volume pot was wired wrong! I just ordered all the components for my project, including a 500kOhm audio taper potentiometer. For the capacitor blocking the DC, I will do some tests directly on the board, I'm afraid that any of my calculation would be off.