I have an arduino MKR Zero board and with an SD card I would like to play a song. What I hear is a lot of noise and the song is faint and very distorted. Does anyone have an idea what could be causing this? Below you can find a schematic of what I have built.
I don't know the MKR Zero. Feeding 5 volt to its Vin looks highly questionable to me.
What type is that 9 volt battery? A fire alarm battery? In that case, throw it away and use better stuff. If not, please post a picture.
You need 5v, not 4.8.
Then, as others have said, connect your power for your amp directly to your power supply.
Finally, while it should run for a little while on a 9v battery, it doesn't have much in the way of amps to drive everything. You should get 2 18650s and run them in parallel into your power supply. Then trim the pot to get 5v.
The gain is WAY too high (although you can knock it down with the pot). Any noise will be over-amplified too. The song shouldn't be faint...
You're getting 3.3V out of the microcontroller and about 5V out of the audio amplifier so you need a gain of less than 2. You DO need current/power gain... The microcontroller can't directly drive an 8-Ohm speaker. But, you don't need much voltage gain.
If you have some powered computer speakers, try those instead of the LM386 and speaker. That will also help to isolate the problem.
Similarly, you can test the LM386 & speaker by connecting it to your computer or phone (or CD player or TV, etc.). But, the gain is STILL too high!