Please test my Jitter Correction timing

BlitzMax Forums/BlitzMax Programming/Please test my Jitter Correction timing

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Probably a bit of both for best results.

something along these lines ... not a working code, just an idea
' buff = array of ints to store deltas
' buffsize = size of the array
' code assumes that buff[] is already populated with deltas

'calculate average first
average = 0
For i = 0 To buffsize - 1
  average:+ buff[i]
Next	
average:/ buffsize   ' buffsize cannot be 0 (zero)

' equalize the spike a bit,  
' probably should be done only when the buffer is full
For i = 0 To buffsize - 1
  ' move anything above or below agerage closer by 1/3 distance from it
  vec = buff[i]+(average - buff[i]) / 3
  buff[i] = vec
Next

' recalculate the average again (spikes should be a bit better)
average = 0
For i = 0 To buffsize - 1
  average:+ buff[i]
Next	
average:/ buffsize


Cheers,
Dima