Question about offset in code

Hello,

I’m trying to understand edge impulse’s code and ShawnHymel’s example code. An offset is used in the audio_buffer_inference_callback function. What is this offset for and why is it necessary? I also saw that this offset is also used in Arduino.

Thanks for the answer!

Kind regards,

Johan

Hi @J.Hogendoorn,

The idea is that the callback function is to be called at some unknown interval from within the run_classifier() function. The offset is a memory offset pointer so that the run_classifier() can copy in raw data from your buffer, one chunk at a time. By working with chunks, you don’t need to duplicate the full buffer for each inference (run_classifier()) call. Hope that helps!