Microphone component with errors on Mac (permissions)

OS Mac
PsychoPy version latest

What are you trying to achieve?:
Microphone recording with transcription turned off. Otherwise default settings.

What specifically went wrong when you tried that?:

Running: /Users/bwinston/Documents/2104/retrieval/psil_movie_retrieval_lastrun.py ##
763.1078 INFO Loaded monitor calibration from [‘2019_11_11 14:00’]
2022-08-03 11:24:40.924 python[29772:2947297] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
||PaMacCore (AUHAL)|| Error on line 520: err=‘’!dat’‘, msg=Audio Device: Unsupported Format
Traceback (most recent call last):
||PaMacCore (AUHAL)|| Error on line 520: err=’‘!dat’', msg=Audio Device: Unsupported Format
1.3271 WARNING Monitor specification not found. Creating a temporary one…
File “/Users/bwinston/Documents/2104/retrieval/psil_movie_retrieval_lastrun.py”, line 486, in
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/psychopy/sound/microphone.py”, line 802, in stop
raise AudioStreamError(
psychopy.sound.exceptions.AudioStreamError: Cannot stop a stream that has not been started.
################ Experiment ended with exit code 1 [pid:29772] #################

Potentially same unsolved issue for many people here.

Any help would be appreciated please.

I did manage to diagnose this problem.

Did you have a duration set for the mic component? I suspect you don’t. If you don’t set a specific duration, there is a bug that will throw this error (discussed here: its in the queue for being addressed). If you set a specific duration, you will not get this error. The error is thrown because the default code generated by builder invokes mic.stop() as if a specified duration has been reached even though a duration is not specified.

thanks @abhandari. i think maybe you were referring to the last part of the error? this is not the main issue. even when specifying the start and stop duration, no recording actually takes place, nor is a file created, and i still get

||PaMacCore (AUHAL)|| Error on line 520: err=‘’!dat’‘, msg=Audio Device: Unsupported Format

Hi @bwinston emphasized text - im not familiar with the PaMacCore (AUHAL). That may be a Mac OS version issue. However, I did have the problem of not getting any .wav files saved.

The issue was Mic permissions - Mac OS needs explicit permission for giving mic access to a software. Unfortunately, PsychoPy standalone does not make that request. The workaround is to run Psychopy via the terminal. Something like: /Applications/PsychoPy.app/Contents/MacOS/PsychoPy
When you do that, you will see a mic permission request (as well as any other permission requests) made by Terminal. Once you provide these, you should start seeing saved .wav files.

1 Like

Wow @abhandari you are a wizard! The workaround you provided works. However, I am hesitant to mark this as the solution because booting PsychoPy with Terminal is less than ideal, especially for the research assistants who will be running our study. Do you know any way to make this work with PsychoPy booted normally? For example, maybe PsychoPy can be added manually via the Security & Privacy Menu?

Will be looking into this and will update. However, you’ve clarified that the issue is not the PaMacCore (AUHAUL) but rather PsychoPy not asking for permission to use the microphone (I imagine that would be an easy fix for the devs?)


Glad it worked.

No - I’ve tried various things, but there doesn’t seem to be any way to make it work without starting it through the terminal. At least for Big Sur, there is no way to explicitly add an arbitrary app to the app permission list. This is not a problem on Windows or Linux machines. Also, you only need to give permission once.

I’m sure there would be a way to fix for the developers - not sure how to tag them here!

1 Like

Thanks either way for your help. Realize it’s the same unsolved problem here as well.

@Becca @Michael any easy way PsychoPy could request microphone access on Macs? Maybe in a future version?

Thanks all.

That’s very strange! We certainly list mic as one of the required permissions when code-signing in what Apple calls “entitlements” as below. I believe that entitlements list should mean there isn’t even a need for the request in the dialog (ie. it’s already been granted). :thinking:

Alternatively, I don’t suppose it’s simply that the request is made while the window is fullscreen? Anyway, I’ll certainly look into this before the next release

1 Like

Actually…maybe this is an incorrect entitlement request. It looks like there’s an com.apple.security.device.audio-input:

Apple Developer Documentation

as well as there being a ...microphone

Apple Developer Documentation

…so maybe we need both.

Apple, why do you torture us so? :sob:


:man_facepalming: thanks for looking into this. in the meantime, do you see any downsides to running our experiment after launching /Applications/PsychoPy.app/Contents/MacOS/PsychoPy through the terminal?

Look forward to this hopefully working normally in the next release! Cheers

Ah, OK I’ve discovered that the microphone entitlement is only for sandboxed apps (typically for the app store) which PsychoPy actually isn’t, whereas audio-input is for hardened apps (signed and notarised) which PsychoPy is. So, basically Apple created 2 very similar sounding options and we got the wrong one.

Regarding the terminal, it’s annoying but I don’t see any problems with it.

best wishes

Dear Jon,

I’m wondering if there is anything that we need to do to adjust the microphone settings when we get this error?

Some have found their wav files are empty. My picture naming task can run and capture wav files, but it will often freeze mid experiment. Never can I run the experiment three times in a row without a crash. It’s very strange. Yet other experiments requiring a verbal response with the same audio library, microphone, etc., can run successfully without issue.

I’ve documented the issue here: Saving trial-level audio output in real time

I’ve tried using all different kinds of microphones, adjusting the frequency range, changing the audio library, opening PsychoPy within the terminal. I continue to get the same error.

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

Any input would be much appreciated.


Hi Frank,

I don’t think your crashes are anything to do with the issue listed in this post, which was caused by a permissions issue in MacOS Gatekeeper and is now solved. For your errors, if some experiments run and others don’t the key next step is to work out what the “minimal working demonstration” of the problem is: what experiment is just enough to make the crashes occur? If you take your working experiment and gradually change it into you not working experiment you can hopefully work out the point where it stops working

But I’m closing this thread because I believe the permissions issue for macos is now solved