I'm trying to get figure how I can include p5.sound to my p5 Sketch. Currently I'm using react-p5-wrapper https://github.com/and-who/react-p5-wrapper/ to get p5 into React.
There's a similar issue raised in the repo and I've asked the same question there too, https://github.com/and-who/react-p5-wrapper/issues/11#issuecomment-728986112 but I can't quite figure out the steps they recommended to solve the problem.
I've added import * as p5 from "p5"
and import "p5/lib/addons/p5.sound"
in my Sketch file but it isn't working. I got the error as per the screenshot.
I'm just trying to follow this tutorial https://www.youtube.com/watch?v=8HEgeAbYphA&feature=emb_logo but try to do it in React.
import * as React from "react"
import * as p5 from "p5"
import "p5/lib/addons/p5.sound"
import * as ml5 from "ml5"
export default function sketch(p5) {
p5.setup = () => {
p5.createCanvas(400, 400)
env = new p5.Envelope()
env.setADSR(0.05, 0.1, 0.5, 1)
env.setRange(1.2, 0)
wave = new p5.Oscillator()
wave.setType("sine")
wave.start()
wave.freq(440)
wave.amp(env)
...