Open mlsteele opened 5 years ago
Also experiencing this when trying to get input from guitar interface. All input samples are 0. On macOS Catalina.
Authorization issues ?
Authorization issues ?
@sletz there’s never a prompt for permissions. Maybe we just need to manually grant mic access to our programs?
Sent with GitHawk
Confirmed authorization issue for me. Thanks @sletz and @tallen11!
The fix, for future readers, is to go to [System Preferences -> Security & Privacy -> Privacy -> Microphone] and add your terminal program, or whatever process is using cpal.
@tallen11 does that work for you?
Evidence:
Running cpal-input-demo on that same machine on the same 10.14.16 version, but months later, resulted in non-zero samples, working as it should. In [System Preferences -> Security & Privacy -> Privacy -> Microphone] there was a checked row for Alacritty (the terminal program I use) allowing mic access. Presumably that either didn't prompt or I denied it prior to September. Then at some point since the row got added.
To make sure I tried with the stock Terminal app. Running cargo run --release
resulted in a prompt asking for Terminal to access mic. After granting, non-zero samples worked. Toggling the permission toggled whether non-zero samples were produced.
Confirmed authorization issue for me. Thanks @sletz and @tallen11!
The fix, for future readers, is to go to [System Preferences -> Security & Privacy -> Privacy -> Microphone] and add your terminal program, or whatever process is using cpal.
@tallen11 does that work for you?
Evidence:
Running cpal-input-demo on that same machine on the same 10.14.16 version, but months later, resulted in non-zero samples, working as it should. In [System Preferences -> Security & Privacy -> Privacy -> Microphone] there was a checked row for Alacritty (the terminal program I use) allowing mic access. Presumably that either didn't prompt or I denied it prior to September. Then at some point since the row got added.
To make sure I tried with the stock Terminal app. Running
cargo run --release
resulted in a prompt asking for Terminal to access mic. After granting, non-zero samples worked. Toggling the permission toggled whether non-zero samples were produced.
@mlsteele Yep seems to work! Thanks everyone.
EDIT: Is there a way to add arbitrary apps to the microphone permissions? I'm developing with CLion and running my project from there has the all zeros issue, while running from Terminal (which has mic access enabled) works fine. But I don't know how to allow either Clion or my program access to the Mic. Thanks.
I have been trying to use this to steal my output audio by using a Multi-Output device with soundflower and am having the zero issue described above. My Multi-Output device is set to send data to both the MacBook Speakers and also the Soundflower (2ch) output. When I open the soundflower (2ch) device for input, I am expecting to see what ever is coming out of my speakers, but all I get is zeros.
Does the authorization issue extend to devices other than the Microphone?
All input samples are
0.0
on this mbp (15-inch, Mid 2015) running macOS 10.14.16Using this code https://github.com/mlsteele/cpal-input-demo, only zero samples come out of the input stream. Other audio stuff works like recording with quicktime.
The same cpal-input-demo outputs non-zero ✅ samples on two other machines. One newer mbp (13-inch, 2016) also running macOS 10.14.6, and one laptop running Ubuntu 16.04.
On the problem machine:
With no
non-zero sample
in sight.What can I do to get non-zero samples from the mic?