That's pretty vague. Is it supposed to vary based on some input that changes or is the heartbeat the input to something else like reading pulse in medical instruments but from a "fake" external source?
Please describe the project in its entirety and your ultimate goal.
Quality speakers will rock the house without being wrapped in anything. Ever stick your head in a bass cannon at a rave? Neither have I...
Turn this up to 11. Human heart beat audio frequency is between 20-150Hz.
Take a look at the IDE example BlinkWithOutDelay.
This example is the mother of all Arduino project timers and can easily be adapted to the systole and diastole, also known as the cardiac cycle, of the heart.