how to make a random heartbeat sound in p5.js

I need to make a sound that resembles a continuous heartbeat that beats at a random speed and amplitude, but I'm having trouble getting the right rhythm and effect. I know envelope is for short sounds, but I can only get the sound to happen once on start. If I use loop it will play one long continuous tone. How can I achieve a repetitive short tone? Also, how can I make the amplitude and frequency and speed random values?

I'm sorry, I'm very new to programming.

Answers

Sign In or Register to comment.