Fix handling of keys, assume sample rate is 1.0
Use flush_interval variable not constant