hmmm I can't see anything immediately wrong. I am wondering whether this has anything to do with the underlying buffering for achieving 2048 samples where something related to the digital I/O gets screwed up over time (it surely hasn't been tested as much as other parts of our codebase) ... one way to verify that would be to run the code replacing one of the digital I/O pairs for one sensor with analog I/O), assuming you have a Bela cape with analog outs. E.g.:
- replace [adc~ 12] with [adc~ 10] (analog in 7)
- replace [dac~ 11] with [dac~ 10] (analog out 7)
and verify whether this misbehaviour still affects all three channels.
Btw, could you verify whether all three sensors start adding those 50cm at exactly the same time? I assumed it would be the case, but just double checking ...