Sounddevice microphone giving empty wav files

OS : Windows 10
PsychoPy version : 2022.1.2
What are you trying to achieve?: Record wav files from the microphone in multiple routines.

What did you try to make it work?:
I’m using the sounddevice library to implement this solution, since the Builder’s default microphone code doesn’t let me record multiple microphones throughout the experiment.
Using the solution above, the files are created but no sound is recorded (empty files). PsychoPy doesn’t give any errors.
I’ve already changed the default.device into all possibilities PsychoPy gives me.
I’ve also tried changing the audio library to sounddevice instead of [pyo, pyogame] (the default).

The microphone does record sound normally if I use a simple demo on the Builder.

Does anyone have any ideas that could help me? Thanks a lot!

Edit: I’ve also tried using sd.write from the soundfile library, but I get the same result, so the problem must be related to sounddevice / sd.rec.

hi there,

Are you coding your experiment from scratch? if so please could you share the code you are using? alternatively if you are using builder please could you share your psyexp?

Thanks!
Becca