Changing microphone device for all microphone components

OS (e.g. Win10): Win11
PsychoPy version (e.g. 1.84.x): 2024.2.1post4
Standard Standalone? (y/n) y
What are you trying to achieve?:
My laptop has a built-in microphone and I also have an external microphone connected to a sound card that is connected to my laptop. I can switch the device in a microphone component between the built-in laptop microphone and my external microphone easily. However, I have a pretty long experiment with more than 10 microphone component in different routines. Is there a way to change the device for all components at the same time?

Psychopy only use the built-in microphone when the device is set to default, even if the external microphone is the default one in the laptop’s system settings

You can just change that setting for each component (takes 5 seconds for each) in that dropdown menu.
The other option is to just reuse that same microphone component (e.g. microphone_1) each time you need a microphone component.
Issac

Thank you for the reply! What I was asking is if there is a workaround so that I don’t have to do it for each of the component. And I don’t think you can use the same component in different routines.

You can’t use the same microphone component in different routines, but it is good practice to reuse routines. What are the differences between your ten routines containing microphone components?

They are completely different with different content/code and are for different purposes. So I guess the answer is I just have to manually change every one of them right?

Here’s another option.

Open the psyexp file in a text editor and then search and replace.

Is this true for all input components? I have been doing this for keyboard responses, rating scales, and even display objects. I haven’t had any issues yet in running my experiments or data, what would be the concern?
Issac

The advantages of reusing routines are two-fold.

  1. It’s easier to debug / modify. If you want to change your font size and you haven’t already set up font size as a variable (which I sometimes do) then you would need to edit every text and textbox component separately. The fewer you have the quicker and more accurately you can make these changes.

  2. If you have lots and lots of routines / components, then there seem to be a memory load implications, at least when using Builder. I’m not sure how much impact this has on the participant.

You can reuse visual and audio components from previous routines using .setAutoDraw(True) and .play(). You can’t reuse keyboard and rating scale components in the same way unless you reuse the entire routine (which I often do – for example in the practice and experimental trials).

If it seems to be fine, then it probably is.