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?



I don’t know if this is gonna help anyone, maybe it’s too specific.
I had the same issue - wav files were saved, but they seemed to be empty, I couldn’t hear anything. What worked for me was disconnecting the microphone I’m using - Scarlett Solo USB - before listening to the wav files with my headphones.
Might have been only a coincidence, but maybe it’s worth trying for some facing the same problem :slight_smile: