extends Node var effect var recording: AudioStreamWAV func _ready(): # We get the index of the "Record" bus. var idx = AudioServer.get_bus_index("Record") # And use it to retrieve its first effect, which has been defined # as an "AudioEffectRecord" resource. effect = AudioServer.get_bus_effect(idx, 0) func _on_psl_button_pressed(): if effect.is_recording_active(): recording = effect.get_recording() print(recording.data.size()) effect.set_recording_active(false) $AudioStreamRecord.stop() $AudioStreamPlayer.stream = recording $AudioStreamPlayer.play() else: $AudioStreamRecord.play() effect.set_recording_active(true)