I would like to know if there is a way to filter some specific sound using FFT on arduino. For instance, there is wind sound frequency in my analysis and I want to take it off. I searched for that a lot, but I didn't find something useful to solve this problem.


FFT is a tool for analyzing sound. It is not very appropriate for filtering, unless you have loads of computing power to spare. And it is even less appropriate for real-time filtering, if that is what you are after.

Attempting to filter-out a noise based on its frequency is a reasonable strategy for narrow-band noise, i.e. noise that lies in a narrow band of frequencies. You can hope that, with some luck, removing this narrow band doesn't affect too much the interesting part of the signal.

Alas, wind noise is very broad band, although it has more weight at low frequencies:

wind spectrogram

(image source).

If the frequencies that interest you are above ≈ 2 – 4 kHz, you could try a simple high-pass filter. Something like this should work even on an Arduino if the sample rate is not too high:

static uint16_t filter(uint16_t input)
    static uint16_t sum;
    uint16_t delta = input - (sum >> SCALE);
    sum += delta;
    return delta

where SCALE is a small constant that determines the cut-off frequency.

Edit: The Z-domain transfer function of this filter is

H = (z − 1) / (z − u)

where u = 1 − 2−SCALE. Its cut-off frequency is then approximately fsamp ÷ (2 π 2SCALE).

| improve this answer | |
  • Excellent answer. Note that AVR based Arduinos are a long way from having "Loads of computing power." In fact they are quite the opposite, and do floating point math in software. Their math is really slow, and FFT is floating point intensive. – Duncan C Sep 5 '19 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.