Help with signal conditioning

newderivative = oldvalue - newvalue ;
secondderivative = oldderivative - newderivative ;
oldderivative = newderivative ; // Remembers the previous one

Yes that should work.

Also, is:

 index = index % LMSIZE;

More efficient than:

index++ ;

if (index >= LMSIZE) index = 0 ; // If LMSIZE is 16 index cannot be more than 15

No, shorter source code does not always mean shorter exe or faster runtime.
The modulo is a division which is one of the most expensive basic math operations.

Yes, please post the code, you want to share, I'll comment (maybe others too :wink: