For a project i am doing audio signal processing on the Arduino Due. In the project i am processing a sound signal in different filterbank implementations. The energy from the different filters is then visualized on LED's.
The purpose of the project is to simulate the signal processing of a cochlear implants, which maps frequency components of sound to different part of the auditory nerves.
To sample the input signal, i am using a interrupt which is triggered at 44.1 kHz. The interrupt handler then does an ADC and stores the input in an input buffer. In the main-loop, a timeframe is cut out of the input buffer and processed in the filterbank.
The execution time of one processing of a timeframe is measured by setting a digital pin high once in the main-loop, and then setting it low a bit after. Using an oscilloscope, the period of this pin can then be measured.
My PROBLEM is, that when i am not applying a input signal to the arduino (playing a sound), the execution time is stable. But when i am applying an input signal, the execution time gets a little longer.
When no input is applied the values in the input buffer will be approximately stable at 0, and when input is applied, the input buffer values lie in the range -2047 to +2047.
The execution time, when there is an input signal, is still quite stable, it is just a bit longer.
For example, for one of my implementations, the execution time goes from 14,2 ms with no input to 17,48 ms when there is an input.
I am quite puzzled as to why this happens. My guess is, that maybe the CPU checks if the input to an operation is zero, and then skips the calculation, but i have not been able to find anything to back this up.
If anyone knows what tricks the SAM3X8E chip is able to pull off, that could affect the execution time, i would be very pleased to know, or maybe just pointed in the right direction