I do:
var hitsound = context.createOscillator()
var gn = context.createGain()
hitsound.connect(gn)
gn.connect(context.destination)
function restart() {
gn.disconnect(context.destination)
gn.connect(context.destination)
}
function buttonpush() {
hitsound.start(0)
setTimeout(250)
var currentTime = 0;
gn.gain.exponentialRampToValueAtTime(0.00001, currentTime + 0.04)
restart()
}
and I get:
InvalidStateError: Failed to execute 'start' on 'AudioScheduledSourceNode': cannot call start more than once.
Error: Failed to execute 'start' on 'AudioScheduledSourceNode': cannot call start more than once.
at buttonpush (/script.js:12:14)
at HTMLButtonElement.onclick (/:11:54)
Its linked up to an html site. Also, I looked everywhere in the internet but it wasnt what I was looking for. Is there any way to fix this issue?