p5.js-sound
p5.js-sound copied to clipboard
setSource() doesn't seem to change source...
Wondering why setSource()
isn't changing the audioIn source?
Example trying it based on the References... while in the console it tells me it changed sources, both in audio-reactivity and in upper corner w/ mic, still says internal microphone.
Just tested in Firefox (less of an issue, since they allow you to select/change mic), in Chrome – the option to change devices is always grayed out.. so it would be great to use this to manually select the source.
Still need to dig into source code... but curious if ths example above works for others? Or is it possible the method to select A/V sources ( demo + code ) has changed implemented?
I know this was a while ago, but I'm having the same issue and it's been preventing me from working on a couple of apps. setSource() just doesn't really work :/
Wondering if anyone has a fix or knows of a workaround?
Same here. I can see the correct list of input devices with getSources() but setSource(0) has no effect, and the input remains the built-in mic, even though I set the default mic in the computer to my Yeti before getting into Chrome. I'm running a MacBook Pro 2018, OS 10.14.6. I'm running p5 in the p5.js Editor/Preview.
Any update on this? I seem to have encountered the same issue on Ma Big Sur. Installed SoundFlower so I can "listen" to system sounds, but setSource doesn't work
No progress to report, although I haven't tried much since my post. I'll check out SoundFlower. Thanks!
@paulcanning + @GenJamGuy if you're using a newer operating system (10.14+, ie. big sur) you may want to switch to BlackHole for monitoring system sounds (then in Audio + Midi Setup, create a multi-output device with both speakers/headphones + blackhole).
In the meantime since I opened this issue, Chrome finally allows you to manually set the microphone input (using 89.0.4389.82 on 10.13.6) when you click on the Mic Icon -> 'Manage' (since the dropdown is deactived) -> then you can select mic input as wanted! Before this option, had to do crazy settings within AudioMidiSetup for sample rate to get Chrome to select the best/worst sound source... ugh.. anyways - so I can manually select it in the browser. Would still be niiiice if this setSource()
would work...
Thanks. I'll give that a shot once I move to big sur (I use an app that hasn't made the jump yet).
Has anyone made progress on this Issue? I can't seem to get p5.sound to use an external mic as an audio source, even when I use audioIn.setSource()
. I am using a TTRS (three ring) cable into the headphone jack of my Macbook Pro 2020, software Monterey 12.4.
I have also gone into Chrome settings and changed the input from "Default" to be specifically "External mic" but p5.sound is still using the Macbook mic for audio. When I check System Preferences, the audio coming through the External Mic cable is showing on the Input bar, so I presume it is working on the hardware level. Just not in the browser when I'm using p5.sound
I found a way, that worked for me:
var mic;
function setup() {
mic = new p5.AudioIn();
console.log(mic.getSources());
mic.start(function () {
mic.setSource(2);
});
Set parameter of setSource()
to the wanted input. You can find it with console.log(mic.getSources());