Designing a Heartbeat That Changes Speed Gradually Based on a Parameter.


(Kyle Kirkpatrick) #1

I am attempting to design a looping heartbeat that will change speed gradually based on a parameter. A previous sound designer had implemented a heartbeat, but the implementation has a couple of problems that I want to improve upon:

  1. For each loop, there is only a single “lub” sound. It should make 2 successive sounds to produce a “lub dub” like a real heartbeat (and thereby emulate the atrioventricular valves and semilunar valves, as Wikipedia has informed me).

  2. The current implementation has numerous loop regions of different length that are selected by the speed parameter. This causes the heartbeat to increase in speed step-wise, not gradually.

I’d like to make the heartbeat increase in speed gradually, and I’d also like to make the amount of time between the “lub” and the “dub” speed up proportionally with the overall heart rate.

I have separate samples for the “lub” and “dub”. I am just struggling to conceive of a graceful way to implement this in FMOD. I have setup an event with the two sounds in a loop region, and at this static speed it sounds good. Adjusting the master pitch gets the speed change I want, but I don’t want to change the pitch of the samples. It seems like there must be a way to just make them trigger faster or slower based on the speed parameter. I keep thinking tempo automation has to be the way, but I can’t conceive of a way to do that either.

I’m thinking I’m going to have to script the behavior I want in the game engine, but I thought I should field the question here to see if anyone had a good suggestion for how to gracefully implement this effect.

Do you have a good implementation idea for me?

[Using FMOD Studio with Unity]


(Kyle Kirkpatrick) #2

Of course–since I just posted about it–I finally had a breakthrough.

I setup two Scatter Instruments on the Speed parameter instead of the timeline. I set the scatter distance to 0 and the spawn interval to 600 ms, with the spawn rate automated from 50% to 160% based on the speed parameter.

I offset the “dub” by setting the delay interval to 320 ms. As long as the playback starts with the speed at 0, the timing between the “lub” and the “dub” sounds perfect and scales properly as the speed increases.

I feel like this could be improved upon though. I wish that the “dub” was explicitly set to follow the “lub”, so that I could prevent potential synchronization issues. Also, if the sound explicitly follows the other, I could give them little timing randomizations to help make it sound more organic. And if I have a technique for that, I could also use it to integrate a squishy sound to follow each heartbeat.

I’d appreciate any suggestions you might have.


(Joseph Harvey) #3

The method your predecessor used, of having multiple loop regions, is the method we generally recommend. It’s relatively easy to set up and maintain, and the “stepped” nature of the changes to the interval is rarely noticeable. (If you want to have both a “lub” and a “dub” and for the time between them to vary with the speed of the heart beat, you can do it by using two separate arrays of transition markers instead of a single array of loop regions.)

That said, if you do want to use a scatterer instrument, here’s how to get the behavior you want:

  1. Remove all the single instruments from your scatterer instrument’s playlist, and then add to said playlist one event instrument.
  2. Double-click on this instrument to open the nested event.
  3. Add the speed parameter to the nested event.
  4. Add a scatterer instrument to the timeline of the nested event. Set the new scatterer instrument’s Min & Max scatter distance to 0 and automate its spawn rate on the speed parameter.
  5. Add your “lub” and “dub” files to the new scatterer instrument’s playlist in the order you’d like them to play in.
  6. Set the scatterer instrument’s spawn total to 2, and set its playlist mode to sequential. (Which is to say, there’s a button at the top of the playlist with a picture of a die on it; click that button until it stops being yellow.) This ensures that the playlist will always play both of its entries in the order in which they are presented when the scatterer instrument is triggered.

The result of following the above steps is that when the scatterer instrument in the parent event is triggered, it will begin playing a heartbeat. The interval of double-beats will be based on the spawn rate automation in the parent event, and the interval between the “lub” and “dub” of each double-beat will be based on the automation in the nested event.


(Peter Hajba) #4

What I did there, was just that - single loop on a timeline, automate the master pitch of the event to speed up the timeline. Place the “lub” and the “dub” one after another on the timeline. However, in addition to that, also automate the pitches of the “lub” and “dub” triggers themselves with an opposite pitch envelope. This way you can retain a sequence, get a step-free change in beat/rate while retaining pitch. And the Lubs and the Dubs can have their own random variations each.

This lets you even do more complicated sequences, like a rate-variable “ba dunk ba dunk” of railway train cars for example.

Turned out to be the simplest solution for me. It can also be placed into a nested event for added convenience.