Hi all,
I’m trying to use two audio inputs (2 microphones) in my p5 js project.
It should be noted that I am using the p5 web editor for this.
This simple program results in an error, and I was going to file an issue in the repository, but I thought it would be wise to first run it through a few people to see if it is just me.
function setup() {
createCanvas(400, 400);
let mic1 = new p5.AudioIn();
let mic2 = new p5.AudioIn(1); // Seems to fail regardless of this number
mic1.start(); // Fails here
}
Results in the error (in the console):
Uncaught TypeError: Cannot read properties of undefined (reading '0')
at RingBuffer.push (11ef0dc2-268f-48d7-84d9-f0c49ecd0d14:81:76)
at AmplitudeProcessor.process (11ef0dc2-268f-48d7-84d9-f0c49ecd0d14:193:28)
I’m not sure I quite understand how to use these in this context. There’s no mention of anything I can see that is useful for multiple AudioIn instances. I’ve tried all of the examples in the references, and none of them seem to work when you add a second input (all fail at the first call to start()).