godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.71k stars 20.12k forks source link

macOS audio recording error: input_callback: AudioUnitRender failed, code: -10863 #58180

Open wenbingzhang opened 2 years ago

wenbingzhang commented 2 years ago

Godot version

v3.4.2

System information

macos 11.6 GLES2

Issue description

input_callback: AudioUnitRender failed, code: -10863 drivers/coreaudio/audio_driver_coreaudio.cpp:237 @ input_callback()

Similar problems and solutions:https://github.com/baresip/baresip/issues/601 I hope a great god can solve this problem.

Steps to reproduce

/Applications/Utilities/Audio\ MIDI\ Setup.app SampleRate 48000 godot MixRate 44100

It can be reproduced by using plug-in.

Minimal reproduction project

https://github.com/c-as/godot-voip

akien-mga commented 1 year ago

Is this still reproducible in 4.0 RC 3 or later?

wenbingzhang commented 1 year ago

Is this still reproducible in 4.0 RC 3 or later?

I just tested it and it can be reproduced.

doing-fine-thanks commented 10 months ago

Hey, just ran into this issue in 4.2dev6.

sean-kintone commented 6 months ago

Official Mic Record Demo project on MacOS also has this error, and fails to record microphone sound as well:

Error:

E 0:00:00:0685   input_callback: AudioUnitRender failed, code: -10863
  <C++ Source>   drivers/coreaudio/audio_driver_coreaudio.cpp:238 @ input_callback()

Demo App: https://github.com/godotengine/godot-demo-projects/tree/master/audio/mic_record

Mac m1 Sonoma 14.2.1 Godot 4.2.1 Stable

Steps:

Open Project, Click Record.

bruvzg commented 6 months ago

The root of the problem seems to be "mix rate" in the project settings, if it's not matching mic mix rate it won't work.

bruvzg commented 6 months ago

It's also won't work if sampling rate for output is too different.

e.g., external mic with 16KHz rate and output with 44.1KHz, setting rate for both to 16KHz will not work in this case. But everything in the engine except mix rate to be the same for all streams, so I have no idea to fix it.

sean-kintone commented 5 months ago

I have confirmed that manually setting my microphone to match the hz in the sample project via macos's settings allows audio to be recorded. This works for both internal and external microphone. Maybe I will try to test that PR linked, because having an entire class of input (audio input) not working on linux or macos fixed might help a lot of people