Stupid bug. Added rounding of the when parameter, since all midi values should be integer.