Output file when recording mic is completely silent

Godot Version

4.6.3.stable

Question

How do I get godot to hear my microphone? The output file has absolutely no sound, but it is readable.

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

Where do I need AudioStreamMicrophone? It is already on the AudioStreamPlayer2D.

My bad missed that! Check those docs and make sure you’ve enabled audio input

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?

For that you can probably look at this

Yes! That worked, thank you. Is there a way I can make it so the sounds from my mic arent played again in the game?

Not familiar with that area, but the documentation should probably have the answer