extends Node2D
var effect
var recording
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
var idx = AudioServer.get_bus_index("Record")
effect = AudioServer.get_bus_effect(idx,0)
effect.set_recording_active(true)
print("record")
var time:float = 0
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
time += delta
if time > 10:
print("save")
time = -INF
effect.set_recording_active(false)
recording = effect.get_recording()
recording.save_to_wav("/home/archie/output.wav")
That’s not what that effect is (on its own), that records the audio on the bus, you need AudioStreamMicrophone, see also AudioEffectRecord for more details
It’s already on. To be honest, my end goal isn’t recording my mic, it’s taking the current pitch out of it to determine which piano note is being played. Is there any way I can do that?