godot icon indicating copy to clipboard operation
godot copied to clipboard

Microphone recording no longer works under Linux

Open goatchurchprime opened this issue 2 years ago • 11 comments

Godot version

4.1.stable

System information

Godot v4.1.1.stable (bd6af8e0e) - NixOS 23.11 (Tapir) - Vulkan (Compatibility) - Mesa Intel(R) Graphics (ADL GT2) - 12th Gen Intel(R) Core(TM) i5-1240P (16 Threads)

Issue description

There has been a regression between v4.0 and v4.1, and the microphone has stopped working under Linux.

This was reported under an older issue at: https://github.com/godotengine/godot/issues/33184#issuecomment-1721110861

I have conducted a git bisect on this issue and found that the regression is between two subsequent checkins in this list from around May 10.

https://github.com/godotengine/godot/commits/master?after=c80a2b4fe99dcd0bba6fc24ed2748b1474b24448+1&branch=master&qualified_name=refs%2Fheads%2Fmaster

image

In particular, this very large commit to do with scene multithreading. https://github.com/godotengine/godot/pull/75901/commits/98c655ec8db17e50afa58284b1dcad754034db4b

There's nothing suspicious or microphone/audio related in that checkin that I can see, but it's hard to break it down further to find out where it went wrong.

Steps to reproduce

Test using the demo projects audio/mic_record between the two versions. https://github.com/godotengine/godot-demo-projects/tree/master/audio/mic_record

Minimal reproduction project

N/A

goatchurchprime avatar Sep 19 '23 22:09 goatchurchprime

Same problem in Manjaro Linux. EDIT: PulseAudio driver in godot, using pipewire in the system. I can see the input created in pipewire, and connected to my soundcard input. It lasts several seconds (time seems unrelated to "audio/buses/channel_disable_time").

After that time, the input is removed, and godot gets a spike in that input (I have an AudioStreamPlayer with a Microphone stream, that scales a visualization sprite)

DavidGasku avatar Oct 21 '23 21:10 DavidGasku

Same on Fedora 38

Calandiel avatar Oct 28 '23 11:10 Calandiel

Same on Windows 10

Kirava0 avatar Oct 29 '23 17:10 Kirava0

I can't reproduce the issue on Mageia 9 with Pulseaudio 16.1. Mic recording works fine for me in 4.1 and 4.2-beta3.

akien-mga avatar Oct 30 '23 13:10 akien-mga

On my machine, Discord, Steam and my own application in Rust all pick up my microphone just fine. Only Godot (latest stable) doesn't and instead records silence.

Calandiel avatar Nov 03 '23 00:11 Calandiel

Confirmed here as well, Godot 4.2.1 Nixos, running pipewire. Audio input works in system apps. Unable to record mic in godot. printing AudioServer.input_device displays nothing as well. Meanwile, get_input_device_list() returns an array correctly.

seanluse41 avatar Jan 01 '24 13:01 seanluse41

I ran some tests again (this time on 4.2.1). Seems to still persist.

Calandiel avatar Jan 02 '24 01:01 Calandiel

I'm experiencing this bug too. Godot seems to be having some issue with pulseaudio and can't read the microphone.

v4.2.1.stable.mono.official [b09f793f5], Pop!_OS 22.04 LTS

In the system logs i see something like this: image The errors start as soon as i launch a project. Interestingly enough, the error is not always present. About 1/10 launches will successfully start recording the microphone. I can actually watch the system log file and detect whether the microphone will work or not on a specific launch by looking for those errors.

MyriadMinds avatar Jan 21 '24 23:01 MyriadMinds

It may be a pipewire-pulseaudio issue, I'm also having the same problem, v4.2.2.rc1.official [c7fb0645a]. Godot returns

E 0:00:12:0141   record_play_microphone.gd:21 @ toggle_recording(): Condition "current_instance->recording_data.size() == 0" is true. Returning: nullptr
  <C++ Source>   servers/audio/effects/audio_effect_record.cpp:207 @ get_recording()
  <Stack Trace>  record_play_microphone.gd:21 @ toggle_recording()

for me. Also don't get mic playback if I unmute the Record bus.

I also use pipewire with pulseaudio. I don't see any weird stuff in the journal, but on my end I also need to change the input in the pipewire patchbay cause it's the wrong one. Default is Yeti Stereo Microphone Analog Stereo, but the webcam is connected instead.

But even if I change the input I still get no recording.

image

razcore-rad avatar Mar 06 '24 12:03 razcore-rad

I had issues with getting microphone to work on a laptop with and nvidia graphics card and proprietary drivers, unless it was run with the nvidia gpu and not the integrated graphics. However it only works in the editor and not while running the game or exporting and running that. If everyone can try doing the same it may give a better idea of what the cause is.

samar-01 avatar Jun 21 '24 23:06 samar-01

I had the same problem with Godot 4.2. Just tried 4.3-beta2 and microphone input is working fine.

skipperro avatar Jun 26 '24 17:06 skipperro

godot4.3 In Android, after starting the recording and waiting for a period of time, such as 3 minutes, then stopping the recording, after multiple operations, recording becomes impossible. I have tried many times, and it seems the probability varies randomly with different devices. I can't find any pattern. Sometimes, when the recording is on, it will directly return -200 after a while.

bestvcboy avatar Jul 26 '24 05:07 bestvcboy

I'm experiencing this bug too. Godot seems to be having some issue with pulseaudio and can't read the microphone.

v4.2.1.stable.mono.official [b09f793], Pop!_OS 22.04 LTS

In the system logs i see something like this: image The errors start as soon as i launch a project. Interestingly enough, the error is not always present. About 1/10 launches will successfully start recording the microphone. I can actually watch the system log file and detect whether the microphone will work or not on a specific launch by looking for those errors.

same error is present with these same logs in v4.3.1.rc

v4.3.1.rc custom build b51be503c512b8f4190503fc28190e0a76ae20eb, Fedora 41

xana43 avatar Dec 07 '24 00:12 xana43

godot4.3 In Android, after starting the recording and waiting for a period of time, such as 3 minutes, then stopping the recording, after multiple operations, recording becomes impossible. I have tried many times, and it seems the probability varies randomly with different devices. I can't find any pattern. Sometimes, when the recording is on, it will directly return -200 after a while.

^^ This particular bug is fixed by https://github.com/godotengine/godot/pull/100508

I feel I should close this bug as I've been using the microphone under Linux for quite a while, and if something is wrong for someone else they can open something more specific

goatchurchprime avatar Jan 24 '25 15:01 goatchurchprime