Skip to content

Commit

Permalink
Sound on
Browse files Browse the repository at this point in the history
  • Loading branch information
gcgbarbosa committed May 5, 2023
1 parent c5656ee commit 8ea24e0
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 2 deletions.
62 changes: 61 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"eslint-config-next": "13.3.4",
"next": "13.3.4",
"react": "18.2.0",
"react-dom": "18.2.0"
"react-dom": "18.2.0",
"tone": "^14.7.77"
},
"devDependencies": {
"eslint": "^8.39.0",
Expand Down
9 changes: 9 additions & 0 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ import anime from "animejs"
import { Container, Typography, Box, Stack } from '@mui/material';
import FavoriteIcon from '@mui/icons-material/Favorite';

import * as Tone from 'tone'


export default function Home() {
const [action, setAction] = useState("Welcome :)");

useEffect(() => {

let animation = anime.timeline({
easing: 'linear',
loop: true
Expand All @@ -20,6 +24,9 @@ export default function Home() {
duration: 3000,
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");
setAction("Breathe IN")
},
})
Expand All @@ -31,6 +38,8 @@ export default function Home() {
duration: 12000,
fill: '#33CC33',
changeBegin: function() {
const synth = new Tone.Synth().toDestination();
synth.triggerAttackRelease("E4", "8n");
setAction("Breathe OUT")
},
});
Expand Down

1 comment on commit 8ea24e0

@vercel
Copy link

@vercel vercel bot commented on 8ea24e0 May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.