-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
Awaiting Maintainer ApprovalNeeds review from a maintainer before moving forwardNeeds review from a maintainer before moving forwardBugError or unexpected behaviorsError or unexpected behaviors
Description
p5.js version
1.11.11
What is your operating system?
Linux
Web browser and version
Brave 1.83.112
Actual Behavior
TypeError: p5.MonoSynth is not a constructor
Expected Behavior
Play a sound when the box is clicked
Steps to reproduce
Steps:
- New sketch
- Use Library Management to change version to 1.11.10, ensure p5.sound.js is On
- Paste the Snippet (which is the example code from the p5.MonoSynth reference page)
- Click Play and click in the "tap to play" box a few times; observe correct behavior of a tone playing
- Use Library Management to change version to 1.11.11, ensure p5.sound.js is still On
- Click Play and observe error message
Note that a new sketch will start with version 1.11.11, and it will work fine. It's only when changing to a different version and back to 1.11.11 that doesn't work.
Snippet:
let monoSynth;
function setup() {
let cnv = createCanvas(100, 100);
cnv.mousePressed(playSynth);
background(220);
textAlign(CENTER);
text('tap to play', width/2, height/2);
monoSynth = new p5.MonoSynth();
}
function playSynth() {
userStartAudio();
let note = random(['Fb4', 'G4']);
// note velocity (volume, from 0 to 1)
let velocity = random();
// time from now (in seconds)
let time = 0;
// note duration (in seconds)
let dur = 1/6;
monoSynth.play(note, velocity, time, dur);
}Metadata
Metadata
Assignees
Labels
Awaiting Maintainer ApprovalNeeds review from a maintainer before moving forwardNeeds review from a maintainer before moving forwardBugError or unexpected behaviorsError or unexpected behaviors