JuliaAudio / PortAudio.jl

PortAudio wrapper for the Julia programming language, compatible with the JuliaAudio family of packages
Other
115 stars 19 forks source link

Audio recording fails on Mac under XQuartz (works with Terminal) #96

Closed JeffFessler closed 2 years ago

JeffFessler commented 2 years ago

The README has a nice example of recording audio, but it does not work on a Mac if you run it from a julia session in an xterm under XQuartz. The reason is that MacOS requires explicit permissions apps to access the microphone and it seems that XQuartz is not smart enough to ask for such permission.

Running julia and then recording from a Terminal worked fine because Terminal asks for permissions (see Privacy tab under Security in MacOS system preferences).

Anyone trying to access the microphone on a system with such permissions may face this issue.

It would be ideal if PortAudio could check to see if it has permission to access the microphone and report an error if it cannot (there must be a way to do this). What is happening instead is that PortAudio just records silently and returns all zeros. And the real time spectrum example just shows an empty plot.

Perhaps this is really an issue for http://www.portaudio.com ?

Addendum: link to microphone access check: https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos

JeffFessler commented 2 years ago

This was an XQuartz issue and it has been fixed now so I close it here at last!