How to make a synth using JS?

My question is: how to make a Synth from a regular audio file?
There are the usual sounds, but there are those that sound a prolonged blast: press the button and the sound will play as long as, for example, the button is not released.

How can I do this? Thank you :)
June 10th 19 at 14:37
1 answer
June 10th 19 at 14:39

buttonElement.addEventListener('mousedown', function() {
 audio.pause(); // or play()

buttonElement.addEventListener('mouseup', function() {; // or pause()

Find more questions by tags AudioJavaScript