How should I decide the cut-off frequency for my low-pass filter?

I'm trying to generate some basic thumping stereo sound using Arduino's PWM pins along with low-pass filters.

This is the frequency spectrum for the sound I want to play using Arduino UNO's PWM pins:

Based on this, I think (from what I understand) the cut-off frequency for the low-pass filter should be around 8900Hz. But, wouldn't the PWM function operate at a much higher frequency to generate the same wave? If that's how it'll be, how should I decide the cut-off frequency for my low-pass filter?

I understand that the fastest frequency one can get for 8-bit PWM on an UNO is 62.5 kHz. So, I might not be able to generate this wave using the UNO itself. Unfortunately, I won’t be able to use another microcontroller for this project. However, what I can do to solve this issue is - generate a different sound wave of lower frequency. If someone can help me with finding out by how much will the frequency of the wave increase if I use PWM to generate it, I’ll be able to generate an appropriate wave.

• Yes, you would need a PWM frequency much higher than the frequency you want, but the PWM frequency of the UNO is fixed at 490Hz (see arduino.cc/reference/en/language/functions/analog-io/…). Doesn't look like that's going to work.
– PMF
Mar 25, 2021 at 8:11
• @PMF I think it is possible to increase the default frequency. Found some tutorials online, but here’s a similar question on this forum: arduino.stackexchange.com/questions/25609/… Mar 25, 2021 at 8:14
• If you have an Uno or some similar AVR-based board, the fastest frequency you can get for 8-bit PWM is 62.5 kHz. You could go faster at the expense of resolution. Mar 25, 2021 at 8:29
• You'll probably want a Teensy for this.
– towe
Mar 25, 2021 at 9:03
• @towe Unfortunately, I won’t be able to use a Teensy for this project. However, what I can do to solve this issue is- generate a different sound wave. If someone can help me with finding out by how much will the frequency of the wave increase if I use PWM to generate it, I’ll be able to generate an appropriate wave. Mar 25, 2021 at 9:10