I have an FFT output from a microphone and I want to detect a specific animal's howl from that (it howls in a characteristic frequency spectrum). Is there any way to implement a pattern recognition algorithm in Arduino to do that? Thanks!

  • We can help you with the programming language and hardware side of things. We can't help you with obscure algorithms. Maybe the maths or physics SE sites would be better for that.
    – Majenko
    Jul 19, 2019 at 18:00
  • Well that's a bummer. I guess I will close the topic then. Thanks!
    – rubemnobre
    Jul 19, 2019 at 21:20
  • Once you have an idea of what you want to choose we can help you code it.
    – Majenko
    Jul 19, 2019 at 21:23
  • You could apply a simple version of Machine Learning; measure, filter, normalize and last match (as distance to collected statistics). Jul 20, 2019 at 9:49

1 Answer 1


It depends.

First you need to break the problem in steps:

  1. If you can make a static analysis, than there is a chance. Meaning, if you can record a snapshot of the howl, and than spend some time processing it.
  2. If you need to process it (almost) real time, than I am almost sure the Arduino is way too slow for that. In the next steps will be clear why, and otherwise you can use the next steps to get some idea how to do the analysis.
  3. Assume you can do a snapshot of the sound, than you have to store it. The Arduino has only 2 KB of SRAM which is way too small. I assume you want a decent frequency (let's say 40 KHz) of mono (1 channel) samples, which is 40 KB of memory.
  4. You need to record this (probably any sound sensor will be fast enough), and store it to some device, either external SRAM (fastest, most expensive), external EEPROM (somewhere in the middle) or SD card (might be slow). EEPROM/SD cannot be written 'forever' so if you want to process a sample every second, you might run in trouble.
  5. Than you need to run your algorithm over the static data. I do not know this algorithm, if you have to iterate many times, forget about using SD, use SRAM or EEPROM. Otherwise, read a few blocks (typically 2 or 3, to get 1 or 1.5 KB) and process it. I hope you can store the result also in the Arduino, otherwise write it (if you write much, probably SRAM is the only well feasible solution).

As you can see, you have to break your problem into smaller pieces, and check how the algorithm works (does it need a lot of data, or a snapshot), can it be processed in pieces, or does it need to iterate over the entire sample data a lot, are there intermediate results need to be stored etc.

Note there might be other solutions:

  • If you need more speed, try an Arduino Due
  • If you need more (internal) SRAM, try a Mega (8 KB) or Due (48 KB)
  • Thanks for the answer! As for the memory problems you pointed out, I think I may be able to get away with it because the spectrum I'm trying to analyse is completely below 1kHz, which means there is no need to have that high of a sampling frequency (I know harmonics can mess it up but I have some hardware filtering).
    – rubemnobre
    Jul 19, 2019 at 16:16
  • And I don't really need to do it realtime-ish.
    – rubemnobre
    Jul 19, 2019 at 16:17
  • still 1 KHz is 1024 bytes, the Arduino has 2048 free bytes, and you might need to store intermediate results. Jul 19, 2019 at 16:17
  • Not realtime-ish makes it easier a lot. Jul 19, 2019 at 16:18
  • I really only need 128 samples per cycle. The sampling frequency only affects the speed the arduino is running at.
    – rubemnobre
    Jul 19, 2019 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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