'touchmove to only play sound once
Hey I'm making a synth in angular and want to be able to slide my finger on all keys to play the keys like a real synth but when trying to use touchmove it spammes the sound but I only want it to play once is there a better way to do it or am I missing something?
My code down below.
Thankful for any help to figure this out.
<rect x="71.428571429%"
(touchstart)="playAudio('F4')" (touchmove)="playAudio('F4')"
class="st0"/>
playAudio(key){
let audio = new Audio();
audio.src = "../../../assets/synth/" + key + ".mp3";
audio.load();
audio.play();
console.log(key)
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
