Godot Version
4.4.1 stable
Question
I am trying to get live microphone feed but I can’t get it working. My code looks like this:
extends Node
@onready var recorder: AudioStreamPlayer = $Recorder
var playback: AudioStreamGeneratorPlayback
var effect: AudioEffectCapture
var bus_index: int
func _ready():
recorder.stream = AudioStreamMicrophone.new()
recorder.play()
bus_index = AudioServer.get_bus_index("Recorder")
effect = AudioServer.get_bus_effect(bus_index, 0)
func _process(_delta: float) -> void:
var frames: PackedVector2Array = effect.get_buffer(effect.get_frames_available())
if frames.size() > 0:
print(frames[0])
and my buses:
The code just prints out zeroes as if there was no sound and in the console it’s spamming this error:
E 0:00:01:918 input_callback: AudioUnitRender failed, code: -50
<C++ source> drivers/coreaudio/audio_driver_coreaudio.mm:260 @ input_callback()
ChatGPT says that this means some parameter is missconfigured but i can’t find what. I have tried restarting my computer, chaning the mix rate to 48000, godot has microphone permissions but it’s still giving me the same error.