-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No input in feedback
and feedback_interleaved
#116
Comments
Hi! Thanks for the report! While I am kinda the active maintainer of this repo, I'll admit that I don't know a ton about the feedback examples. Looking at the git history, @HEnquist (sorry for the tag, feel free to tell me it's unwanted) authored those examples 3 years ago. 3 years is a bit of time but maybe Henrik has got some ideas. My intuition is that macOS has changed since #83. Similarly, iOS 17 has AVSession issues in certain cases. If you were to debug this more and submit a PR, it'd be very welcome. |
I'll take a look. I'm not aware of any changes in macOS that cause trouble and I have not needed to make any changes to my own projects to run on the latest macOS versions. I have no idea about iOS. It's quite common to struggle with permissions. Have you allowed the terminal app to access the microphone? |
I just tried the feedback example and it works fine here on Sonoma. This example is perhaps a bit too simple, it runs at 44.1 kHz but it does not try to switch the capture device to this sample rate. If the default capture device (likely the built in microphone) is set to another rate, the input callback won't get called. So, open Audio MIDI Setup and make sure that both the default capture and playback device is set to 44.1 kHz. Or use another value, and adjust the SAMPLE_RATE variable in the example accordingly. |
Seems like let sample_rate: f64 = input_audio_unit.get_property::<f64>(
kAudioUnitProperty_SampleRate,
Scope::Input,
Element::Input,
)?; then using it in output_audio_unit.set_property(
kAudioUnitProperty_SampleRate,
Scope::Input,
Element::Output,
Some(&sample_rate),
)?; The biggest problem with these examples is that they're not "just works" examples. It depends on luck (if your default input device sample rate is set to |
Anyway thanks, it works now! Also fyi @simlay, a bit of UX feedback:
|
Yes there is certainly room for improvement. There is a challenge in that we can't know what devices have been set as the defaults and how they are configured. I think it would be good to mention this somewhere, and recommend that the examples are run with the built in devices chosen as defaults. But it would be good to at least try switching the sample rate to show how it's done.
I can only answer for myself here. I haven't needed this so I haven't looked at it. But IMO it would make sense to include support for this.
I think this second option is the correct way to do this, but I have no experience with actually doing it. I usually switch the hardware sample rate to the value I want, and avoid the need for conversions. |
Summary
So the feedback examples from
0.12.0
are not working - there's no audio data captured (mic device is opened and there's an orange dot indicator in macOS status bar):cargo new --bin
coreaudio-rs = "0.12.0"
to dependencies in Cargo.tomlsrc/main.rs
output cb {} frames
and noinput cb {} frames
logsInfo
14.5 (23F79)
0.12.0
The text was updated successfully, but these errors were encountered: