I am trying to create a rolling buffer for audio classification, so that audio is being recorded while inference is happening. I am using 2 second audio clips. I added some print statements to the microphone_audio_signal_get_data() function in the Arduino example app to get a better sense of the pattern for reading data off the buffer. I printed out the Offset and Length that is passed to the function during inference. The results are a little unexpected. It looks like it will read in 320 samples, then re-read the a single sample at the end of the last read. It also never reads in the final set of 320 samples.
Is this the expected behavior? I also tried it with 1 second audio clips and the general pattern was the same.
Starting inferencing in 2 seconds... Recording... Recording done offset: 31999 length: 1 offset: 0 length: 320 offset: 319 length: 1 offset: 320 length: 320 offset: 639 length: 1 offset: 640 length: 320 offset: 959 length: 1 offset: 960 length: 320 ... offset: 31359 length: 1 offset: 31360 length: 320 Predictions (DSP: 1452 ms., Classification: 139 ms., Anomaly: 0 ms.): noise: 0.99609 siren: 0.00000