fixed hardcoding of 100 Hz sample rate, now works with arbitrary sampling rates