Add audio fade to remove audible 'pop' within sine's sound-on-click (#3895) jerryzhou196

* added audio fade

* removed accidental space

* lowered fadeout time

Co-authored-by: Miodec <jack@monkeytype.com>
This commit is contained in:
Jerry Zhou 2023-01-09 06:43:23 -05:00 committed by GitHub
parent 89024555a9
commit d342a08d8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -374,7 +374,8 @@ export function playNote(
oscillatorNode.frequency.value = currentFrequency;
oscillatorNode.start(audioCtx.currentTime);
oscillatorNode.stop(audioCtx.currentTime + 0.15);
gainNode.gain.setTargetAtTime(0, audioCtx.currentTime, 0.15); //remove click sound
oscillatorNode.stop(audioCtx.currentTime + 0.5);
}
export function playClick(): void {