Chirping Sound in audio output of Arduino Uno

Hi, there, I am getting some chirping sound from the audio output of my Arduino Uno. I am trying to make an audio player out of arduino uno. So far, I have used an SD card module to store the music files, and using TMRpcm library for playing audio files. My problem is, whenever, arduino starts playing an audio file, it generates a chirping sound, just for a 0.5 second every time. It happens in starting of every audio file. The audio files themselves are clear, and don't have any kind of sound like that. It happens with every audio file I tried to play through TMRPCM library. I'm using Digital pin 9, which is also a PWM pin on atmega328p. I am using an external speaker with AUX input to play the audio files. I am also using an RC filter in between arduino and the external speaker, to cancel out the DC noise from the audio signal. The RC filter I have used is a low pass filter with cut off frequency of 3kHz (where R=5k ohm, C = 10nF, and a coupling capacitor of 10uF electrolytic, in between RC and External speaker). I have asked to my professor as well about this issue, and he said this has something to do with the PWM pins of atmega328p. The uno-clone I'm using has an SMD atmega328p AU (TQFP32 package). Please let me know if you have gotten the same problem. If you know how to solve this problem please answer.

What happens when you run the example sketches from the TMRpcm library?

I've never used TMRpcm...

Is that between the Arduino and amplifier, or do you have powered speakers (with a built-in amplifier)?

I don't know what the PWM frequency is for TMRpcm (I know it's higher than the default PWM) but a 3kHz filter should filter it out, giving you pretty-good analog.

A "chirp" seems odd. A "click" or "pop" when the audio starts wouldn't surprise me. Since the Arduino can 't put-out the negative waveform, the output has to be biased. That means silence has to be at 50% PWM. Whenever that bias kicks-in (when the audio starts, or before the audio starts, there WILL be a pop or some kind of glitch.)

I don't know when that happens with TMRpcm. There might be something in the documentation. Maybe you have to play a silent file first?

When I run the sketches from the TMRpcm library, At first I hear a chirping sound, like any other DC noise, but only for a moment. Just after that, I hear the audio/song from the speaker, which is usual and clear.
Every time I run the arduino, the audio played later is always fine, but I get that sound at first seconds of every audio file. The sound is similar to a DC noise as I said, but only lasts for a moment.

I am using a powered speakers with inbuilt amplifiers. Just in order to block DC noises I use a RC circuit in between microcontroller and speaker.

Just to be sure, why not post a schematic...

Also have you followed to find out if this helps?:

1. Pop or click when playback is started or stopped:
  Ramps are built into the library to prevent popping when PWM is engaged, disabled, and between music tracks of the same
  sample rate. See the [Advanced Features wiki page](https://github.com/TMRh20/TMRpcm/wiki/Advanced-Features) for causes and fixes.

Have you tried feeding the audio to a different speaker/amp?

Hi, I don't have any proper schematic, but I think this would help! This is a schematic of a board that I am currently designing.! The circuit I am currently using is just like it with same components. But I am using an Uno instead of just a microcontroller.

Screenshot 2021-08-26 231723|675x500

Okay, two more answers expected.

Thank you for the link. I haven't tried feeding the audio output to any different speaker. But I will do that.

It seems to me that what you have explained here about the "pop" and the "bias kicks-in", I think, that might be the case in my device. However, what's a silent file?