Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio Mic Recording results in silence #69755

Open
Tracked by #76797
Foxomat opened this issue Dec 8, 2022 · 9 comments
Open
Tracked by #76797

Audio Mic Recording results in silence #69755

Foxomat opened this issue Dec 8, 2022 · 9 comments

Comments

@Foxomat
Copy link

Foxomat commented Dec 8, 2022

Godot version

3.5.1

System information

Windows 10, GLES3

Issue description

I wanted to implement voice chat in my game. I took a look into the Audio Mic Record Demo and noticed it wasn't working as intended:

  • When recording audio and then clicking on "play", you hear nothing.
  • When saving the recorded audio to a file (using save_to_wav() in this case) the resulting file is only silence

I made sure my mic is working: when I disable "muted" on the record audio bus, I can hear my voice in the demo, so the mic input actually gets to the game.

May be related to #33184

Steps to reproduce

Follow the Recording with microphone Tutorial or try the Demo Project

Minimal reproduction project

Demo Project

@Calinou
Copy link
Member

Calinou commented Dec 8, 2022

Do your Windows privacy settings allow apps to access the microphone (Allow apps to access the microphone setting)? The microphone permission in the Windows settings affects both Win32 and UWP applications, even though it doesn't look like it at a glance.

@fire
Copy link
Member

fire commented Dec 8, 2022

Mic recording for voip uses like triggering every fraction of a second and returning a buffer is not expected to work with AudioStreamRecord.

The expected use case for AudioStreamRecord is you start it and record a lengthy period.

https://docs.godotengine.org/en/stable/classes/class_audioeffectcapture.html was written for the use in voice chat systems.

For 4.0, we wrote a speech plugin for voip and has a networked demo.

https://github.com/V-Sekai/godot-speech

@Foxomat
Copy link
Author

Foxomat commented Dec 8, 2022

Do your Windows privacy settings allow apps to access the microphone (Allow apps to access the microphone setting)? The microphone permission in the Windows settings affects both Win32 and UWP applications, even though it doesn't look like it at a glance.

Yes. When running the demo I can see in the windows settings that it uses my mic. And as I wrote, when unmuting the record bus, I can hear myself in the demo.

@fire
Copy link
Member

fire commented Dec 8, 2022

So recording works?

@Foxomat
Copy link
Author

Foxomat commented Dec 8, 2022

Mic recording for voip uses like triggering every fraction of a second and returning a buffer is not expected to work with AudioStreamRecord.

The expected use case for AudioStreamRecord is you start it and record a lengthy period.

https://docs.godotengine.org/en/stable/classes/class_audioeffectcapture.html was written for the use in voice chat systems.

For 4.0, we wrote a speech plugin for voip and has a networked demo.

https://github.com/V-Sekai/godot-speech

Yes, for my demo I try using the Godot 3 VOIP plugin now. (which uses AudioEffectCapture)

So recording works?

I don't know which part of it doesn't work. I've written above when I can hear myself and when I don't.

@starcin
Copy link

starcin commented Feb 17, 2023

I want to add to this.

I am having trouble with recording sound via microphone using both 3.4.2 stable and 4.0 RC1.
While looking through related issues, I've seen very recent PRs (#69120 and #72898) and cloned the latest state of master branch on Feb 16.
I've spent the whole day compiling (this is my first time compiling the engine on my own) and trying to make the recording work. (v4.0.rc.custom_build [953383328])

Combining every suggestion in multiple issues, I made some little achievements:
I've disabled playing and autoplay properties of the recording player. And I run play() at _ready. And unmuted the bus with Record effect.
This way, when I start recording in game, I can clearly hear my echo via speakers AND since I am printing the peak volume to a label, I can see the value changes as a speak. So it clearly recognizes the microphone and gets the sound.

But when I print the data array of the recording (AudioStreamWAV.data), it is full of zeros and nothing else. If I record the audio, I can see that the length of the audio file is correct but it is only silence.

I am also adding my minimal project.
VoiceTest.zip

@sanchitgulati
Copy link

same issue, with Godot4rc4. I can hear the mic if I unmute the Record Bus but record_effect.get_recording() gives me silence.

While exporting the wav file, the size reflects the duration of the recording.
Basically short recording gets me a small wav file and a longer recording gives me a larger wav file, but there is no data in those files. It's just silence.

I am using the mic_record sample (updated to Godot4).
OS: Windows 11

@Promptineer
Copy link

Promptineer commented Mar 28, 2023

Still having this issue with Godot 4.01 stable. Windows 10.

I followed https://docs.godotengine.org/en/stable/tutorials/audio/recording_with_microphone.html exactly on a new project as well. I also made sure to enabled audio input in project settings. Please help :'(

Edit:
I fixed it! No more silent recordings! It seems it was an issue with conflicting audio drivers. Uninstalling Sonic Studio 3 and ASIO4ALL followed by an old fashioned restart fixed the issue. I removed them both before testing, so I'm not sure which one was the problem.

If you are still having this issue on Windows, I would recommend going through your installed programs and removing any audio drivers that you do not need to see if it fixes the problem like it did for me.

@Foxomat @sanchitgulati @starcin

@dev-mico
Copy link

dev-mico commented Feb 9, 2024

yep, unfortunately for me uninstalling drivers didn't work (but I do have multiple). my laptop comes with Nahimic and other drivers, which is a pain to uninstall. hopefully this gets fixed soon, really need this functionality for my game.

OS: Windows 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants