Gradually decreasing timer value

Hi all

I am trying to control a sound of a human heartbeat depending on the time of the game. As the game continues on, the heartbeat goes faster and faster thus indicating end of the game. The level has 5 minutes to be completed and I want to increase the heartbeat from 60bps to 120bps

I’m quite stuck and I can’t seem to figure out how to do this. Any help will be greatly appriciated


Hey there, if you want to go from 60 bps to 120 bps in 5 minutes, then you can use a lerp, where A is 60, B is 120 and alpha is the time it has passed so far divided by 300 (which is 5 minutes in seconds). and that will give you the heartbeat speed.

So this is what I came up with, it still doesnt quite work. It does delay for 1 second and then plays the cue rapidly while overlapping the sound. I set A for 1 (1 heartbeat per second) and 0.5 (2 heartbeats per second). Am I missing the point here?


Just do a normal float by float division for the alpha, then set A to 60 and B to 120 (this allows to control the values easier instead of 1 and 0.5). Then you divide 60 by the return value of the lerp, this will give you how many times per second it should trigger. The main problem you have is having a retriggable delay in the tick, that will be constantly overriding the delay. I would maybe do a timer in begin play that runs an event that plays the sound and schedules the next time the function should be called.