Godot Version
4.4
Question
I’m trying to get the volume of a microphone input as a numerical value. I have been able to find information on how to achieve this in Godot 3, but I am not sure how to implement the feature in Godot 4.
When I use the code below, I receive a “Unexpected identifier ‘_ready’ in class body”
extends Sprite2D
var spectrum
var volume
_ready():
spectrum = AudioServer.get_bus_effect_instance(1, 2, 0)
_process(delta):
volume = spectrum.get_magnitude_for_frequency_range(0, 10000).length()
print(volume)