Git Product home page Git Product logo

p5-next's People

Contributors

gonzarascon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

p5-next's Issues

Types for p5.sound

Thank you for this repo. It has been super helpful when setting up NextJS + P5.js + Typescript ๐ŸŽ‰
https://github.com/gonzarascon/p5-next/blob/main/p5/base.p5.ts

Have you had any luck in including the types for the p5.sound library? I keep getting

Property 'getAudioContext' does not exist on type 'import("/Users/jeremy/Sites/joinbonsai/client/node_modules/@types/p5/index.d.ts")'

My setup is largely the same as the one you have in the repo:

import type p5Type from "p5"

let x = 50
let y = 50
let mic

const canvasX = 600
const canvasY = 600

export const setup = (p5: p5Type, canvasParentRef: Element): void => {
  const canvas = p5.createCanvas(canvasX, canvasY).parent(canvasParentRef)
  p5.getAudioContext().suspend()
  const mySynth = new p5.MonoSynth()
  mySynth.play(random(["Fb4", "G4", "A6"]))
  canvas.onclick = userStartAudio
  mic = new p5.AudioIn()
  mic.start()
  p5.fill(255)
  p5.background(0)
}

The only other mention I have seen on adding in Typescript support for p5.sound is https://github.com/Gherciu/react-p5#with-p5sound--nextjs-or-other-framework-which-has-support-for-ssr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.