godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.08k stars 21.18k forks source link

AudioEffectRecord has more latency when using an USB microphone compared to an analog microphone #54544

Open risunz opened 3 years ago

risunz commented 3 years ago

Godot version

3.3 Stable

System information

Solus OS 4.3

Issue description

I make a software that capture a voice input using a microphone. I realize that analog microphone with audio jack works perfectly fine but usb mic will have a latency issue. It takes time bofore showing an output that "audio is captured"

Steps to reproduce

this line of code: var power = AudioServer.get_bus_peak_volume_left_db(AudioServer.get_bus_index("Record"), 0)

with the attached bus and audiostreamplayer setups image image

For some reason, usb mic user will get a delay for the output.

Minimal reproduction project

No response

Calinou commented 3 years ago

@airisun Can you reproduce this delay in other recording applications such as Audacity (when using the USB microphone)?

Also, can you reproduce this if you make the project use ALSA instead of PulseAudio by changing the audio driver field in the Project Settings from PulseAudio to ALSA (case-sensitive)?

risunz commented 3 years ago

I forgot to mention that I'm reporting this because my software users (Windows users and usb mic users) are having the delay with the exported software. Since I don't have usb mic right now, I cannot confirm if the problem is only after exporting or in the editor too. Anyone with usb microphone can try this project file. Mic Testing.zip

This is the software: https://ai-risun.itch.io/gazo-tuber

fire commented 3 years ago

I am wondering if moving to lower level AudioEffectCapture from AudioEffectRecord will allow you to remove the latency.

risunz commented 3 years ago

Based on issue #51195 it is fixed. But I can confirm it is still not fixed for mine. Im using Godont 3.4 Beta6. Godot seems to repeat my voice twice. Im using USB Mic

https://user-images.githubusercontent.com/50040102/140875222-1cb7bff3-2957-4da8-ab05-d810cb072360.mp4

.

risunz commented 3 years ago

My thought is, it's wasn't a delay but Godot is repeating the captured audio twice. Thus it makes Godot seems to showing a delay.

risunz commented 3 years ago

In my case, Godot repeat my audio for awhile. After than, it's not repeating but just delay.

risunz commented 2 years ago

I got another report from a Mac user. They are using Blue Snowball and it seems godot cant catch the input too.

vgf89 commented 2 years ago

I also get this issue or something very similar. I haven't tried 3.4.3 yet (just 3.4.2) but my blue snowball also seems to get doubling, a build up of delay, and popping on both Windows 10 and 11. It works properly in every other application except for Godot.

I'm not using the record effect, instead I'm just using SpectrumAnalyzer

risunz commented 2 years ago

Your issue is probably the same as mine. I really hope someone in the community have some ideas regarding this issue. I really don't know what to do haahhaa. I love Godot and I want to continue working my software with it. I hope the issue will be resolved later. Thank you.

fire commented 2 years ago

There is less people in the audio team so this may not be resolved soon.

https://github.com/godotengine/godot-proposals/issues/2013 was the lower level replacement for audio record we wrote for voice calls in games.

risunz commented 2 years ago

Aww I see. It's fine then. Thanks for the hardwork!