Builder Saving Empty Audio Files

OS: MacOS Monterey (12.5.1)
PsychoPy version: v2022.2.5
Standard Standalone? (y/n) If not then what?: Yes
What are you trying to achieve?: I am trying to save per-trial audio recordings, but when I go to process the audio in Praat, the .wav’s are empty

What did you try to make it work?: I first followed the advice here, so my rate is set to 16kHz and I’m defaulting to pyo as my audio library. I also followed the advice here and deleted pygame from my list of audio libraries and moved pyo to the top.

What specifically went wrong when you tried that?:
Here’s my error messages from running a minimal experiment (a text promt to talk, keyboard input to end the trial, and the microphone for recording audio)
1628.9685 INFO Loaded monitor calibration from [‘2023_02_26 23:34’]
2023-03-10 21:24:15.505 python[2229:31977] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/_3/sws90zt124zfvby14f1cn8h40000gn/T/org.opensciencetools.psychopy.savedState
PTB-INFO: Using modified PortAudio V19.7.0-devel, revision unknown
||PaMacCore (AUHAL)|| Error on line 520: err=‘‘what’’, msg=Unspecified Audio Hardware Error
||PaMacCore (AUHAL)|| Error on line 520: err=‘‘what’’, msg=Unspecified Audio Hardware Error
PTB-INFO: New audio device 0 with handle 0 opened as PortAudio stream:
PTB-INFO: For 1 channels Capture: Audio subsystem is Core Audio, Audio device name is MacBook Air Microphone
PTB-INFO: Real samplerate 16000.000000 Hz. Input latency 95.000000 msecs, Output latency 0.000000 msecs.
0.8405 WARNING pyo audio lib was requested but not loaded: ImportError(“dlopen(/Applications/, 0x0002): Library not loaded: ‘@ loader_path/libportaudio.2.dylib’\n Referenced from: ‘/Applications/’\n Reason: tried: ‘/Applications/’ (no such file), ‘/usr/local/lib/libportaudio.2.dylib’ (no such file), ‘/usr/lib/libportaudio.2.dylib’ (no such file)”)
0.8722 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘pyo’, ‘sounddevice’, ‘PTB’] (in that order).
1.1085 WARNING Monitor specification not found. Creating a temporary one…
ioHub Server Process Completed With Code: 0
################# Experiment ended with exit code 0 [pid:2229] #################

Hey @Nadav_Benjamin

Do you have to use pyo as your audio library? I used the PTB library and it worked well. I suggest trying out to see if it makes a difference.

Also check out your microphone frequency range. There may be an optimal range from which to sample. Some of my lower end mics can go as high as 18 k whereas pricier mics can record at a higher res.

Unfortunately some of my experiments still randomly freeze mid-trial and I get the same error as you.

||PaMacCore (AUHAL)|| Error on line 520: err=‘‘what’’, msg=Unspecified Audio Hardware Error

I still haven’t found a way to address the problem that leads to this error.

Hope this helps you out.

Thank you so much!
I’ve switched to ptb, but it’s still saving empty files :frowning: The strange thing is that when I run the microphone feature demo it saves the audio just fine, but not when I run my minimal routine even though it looks like all my settings are identical. I’ll keep fiddling with settings and see what works!
Take care

I think I’ve cracked the code - I checked out the .csv outputs and I found that the microphone was starting and immediately stopping. I came across this post and saw that the issue was that I was not passing a duration to the microphone component. So I set a duration and voila! It’s recording nicely. Thanks so much for your help!

1 Like

@Nadav_Benjamin Great to hear that! Do you mind sharing your experiment?

I just can’t figure out why I continue getting this error…

||PaMacCore (AUHAL)|| Error on line 520: err=‘‘what’’, msg=Unspecified Audio Hardware Error

It would be great to have a look at your task to compare/contrast.


Of course! I’m a linguist so don’t be alarmed when stuff that isn’t in English pops up, but you’ll get the hang of it.

practiceWordList.csv (40 Bytes)
Translation Task.psyexp (43.5 KB)
Translation (51.9 KB)
translationWordList.xlsx (10.1 KB)

My struggle now is that when I run it in Pavlovia, it interrupts the session to download each audio file individually, like it opens up the “save as” dialogue box right in the middle of the trial, and it repeats that for every. single. repeat.

All good! It was helpful to see how your mic was set up.

I have no experience using Pavlovia. Sorry I can’t help you here.

Hopefully someone else reading this will provide input.


Sound files are downloaded immediately when piloting but should be silently saved to the server when running.