From 23d13fedf705df3f72546cceda5749bf639c2e20 Mon Sep 17 00:00:00 2001 From: "George C. G. Barbosa" Date: Sun, 14 May 2023 07:01:46 +0000 Subject: [PATCH] Fix minor bug --- src/pages/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pages/index.js b/src/pages/index.js index 12ba204..d06df71 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -8,9 +8,12 @@ import * as Tone from 'tone' export default function Home() { + const [action, setAction] = useState("Welcome :)"); useEffect(() => { + const synth = new Tone.Synth().toDestination(); + Tone.Transport.start(); let animation = anime.timeline({ easing: 'linear', @@ -25,8 +28,7 @@ export default function Home() { fill: '#FF0000', changeBegin: function() { //play a middle 'C' for the duration of an 8th note - const synth = new Tone.Synth().toDestination(); - synth.triggerAttackRelease("C4", "8n"); + synth.triggerAttackRelease("C4", '8n', Tone.Transport.now()); setAction("Breathe IN") }, }) @@ -38,8 +40,7 @@ export default function Home() { duration: 12000, fill: '#33CC33', changeBegin: function() { - const synth = new Tone.Synth().toDestination(); - synth.triggerAttackRelease("E4", "8n"); + synth.triggerAttackRelease("E4", '8n', Tone.Transport.now()); setAction("Breathe OUT") }, });