Closed fkeyzuwu closed 8 months ago
Are you using Bluetooth audio with microphone enabled? This limits audio output to mono and will greatly decrease its quality.
No, I'm using good quality wired headphones and speakers with a Focusrite mini audio interface. I'm not talking about mono signal. When it happens, it sounds like the file is "half corrupted", meaning the information you hear is still some what related to the original signal, but is weirdly distorted. And again, hearing anything else outside of Godot works completely fine, I A/B tested it in real time. Hopefully I'll have something to show for when this happens again and I record it.
This doesn't seem to be related to these other issues you mentioned imo.
I'm having the same issue. I'm using Godot 4.0.1 Stable. Headphones are wired and no audio issues outside of Godot. I tried mp3 wav and ogg. Every format is working fine on windows10 media player or VLC media player. As soon as i import them to Godot the Audio is laggy/crackling on the prewiev and on AudioStreamPlayer and also in-game
Edit: i tried using my cheap wireless headband hedphones and for my surprise the audio lagging/cracking is gone. my main headphones are going through a scarlett 2i2 (3rd gen) audio interface which sample rate is set to 44100 and the Buffer size was 512. Reducing the Buffer size to 256 solved my problme inside Godot
I'm having the same issue.
Edit: i tried using my cheap wireless headband hedphones and for my surprise the audio lagging/cracking is gone. my main headphones are going through a scarlett 2i2 (3rd gen) audio interface which sample rate is set to 44100 and the Buffer size was 512. Reducing the Buffer size to 256 solved my problme inside Godot
This is the exact problem I'm pretty sure. I also had the problem reoccur to me, and when switching from 512 to 256 buffer size the audio stopped stuttering. I have a Scarlett mini. this might have to do specifically with Focusrite products, needs checking. This also happens with exported godot games made on godot 4.0.x, I figured this out because I entered the Godot Wild Jam where I'm sure most of the people used godot 4.0.x. all their games had that problem on my pc, and ours which was made on godot 3.5.2 stable didn't have that audio stuttering problem regardless of the buffer size.
Video attached here. Notice that there are some stutters even when being on 256 buffer size.
@Calinou
I can attest to this possibly being related to focusrite products, I have a scarlet 2i2 and get the exact same audio corruption usually until a pc restart
@Psiice, @fkeyzuwu, @yaboigraves did you also test without scarlett (the usb audio interface) and directly connecting the (good) headphones to your computer? (And I don't mean wireless/bluetooth)
I am also running into this issue; when Godot output is through my Focusrite 2i2, the sounds played from Godot are inconsistently distorted (in a bitrate way).
Plugging into and using any other standard audio outputs on my PC makes the issue go away. My audio files are all Mono 16 bit 44100 Hz .WAV files.
I fiddled around a little bit this afternoon, I was able to fix the distortion by going into Focusrite Control and setting the sample rate (under Device in the toolbar) to 44.1 kHz. the default setting is 48 kHz. Edit: I also found that playing the same files in Audacity with the 48kHz samplerate produced the same distortion, so I am inclined that this is not really godot's fault.
@MJacred
I am encountering this issue as well, with the Focusrite Scarlett 2i2, and can confirm that when plugging directly into my computer the audio is fine. Setting the Scarlett's sample rate to 44100 did not help, although strangely setting it to 192000 did make the audio in Godot no longer bug for the moment. However, this bugs out all of my other audio software, meaning I'll have to switch back and forth a bunch.
hey. been running into this issue a lot. Audio sounds like its cutting out and stuttering, happens frequently but at unpredictable times. Happens in game when the game is running, but it also happens in editor when playing an audio file
Here is an example of the waveforms of a recording, showing gaps in the audio:
I have a Steinberg brand UR22mkII USB audio interface that my headphones are connected to. Reducing the buffer size the driver settings from 512 to 256 seems to have improved the issue, as well as seeming to improve the overall smoothness of the game. However, the stuttering still occurs, just much less frequently
@Psiice, @fkeyzuwu, @yaboigraves did you also test without scarlett (the usb audio interface) and directly connecting the (good) headphones to your computer? (And I don't mean wireless/bluetooth)
Sorry, didnt see your message. but no, It doesn't happen while directly connecting my headphones to the pc.
Is anyone looking at solving this problem? I would assume it should be relatively high importance. Depending on severity it can happen very commonly, and be almost unfixable(for me changing the buffer size doesn't guarantee it being fixed 95% of the time). Also might be happening on other audio interfaces as implied by @moehnked. And as I said, this is not a problem with JUST the editor, it also happens on exported projects, meaning pretty much any project that is out from this Godot version onwards will very likely have this problem. It can pretty much make the game unplayable with audio for some people. It's also worth mentioning that these Focusrite audio interfaces are very common.
@Psiice, @fkeyzuwu, @yaboigraves did you also test without scarlett (the usb audio interface) and directly connecting the (good) headphones to your computer? (And I don't mean wireless/bluetooth)
Without using my scarlet 2i2 and just using my PC soundcard this does not occur ever.
Is anyone looking at solving this problem?
We have relatively few audio contributors (I am not one of them). Also, not all of them have access to a Focusrite DAC (which isn't cheap for something you'd buy just to fix a bug).
What's the cheapest Focusrite DAC on which the issue has been confirmed?
scarlet 2i2 i believe is the cheapest model, I'd honestly be willing to be put in contact with an audio engine dev who's interested in tackling this and shipping them mine to borrow, as I have a 6i6 I use for daily work anyways. Worth a shot I suppose!
Including this issue, I'm aware of 3 other issues that sound very similar. All of them have in common that there is another audio-related process running. And that the issue popped up between v4.0-beta 14 and 15 (source). @Calinou referenced the Engine commits here. They are an excellent starting point for the investigation.
Therefore, if I'm not mistaken about the issue relations, it should be possible to find and solve the issue without requiring an audio interface. Unless proven otherwise.
In turn, this means that also non-audio engine devs can bisect the regression and look out where audio code was touched. Anyone who can compile the engine from source can greatly help fixing the root cause!
This issue happens no matter what sample rate you are using in the project settings and no matter what sample rate you are using in the Focusrite settings. This is an isolated bug in Godot since this stuttering issue only happens inside Godot and programs made by using Godot (ie, using Godot code). I have been using a Focusrite device for over 5 years and Godot is the only place where this issue happens, which makes it safe to say that this is not any external issue or user error. I have worked on and developed low latency audio playback software and never came across this issue either (while using a Focusrite device with latest Focusrite drivers).
Changing the sample rate inside the Focusrite settings is not a fix, it only resets the Windows output device, and Godot probably catches that event. It will still slowly drift away and it will start stuttering again which makes this seem like an accumulation error (such as missing a loop somewhere when feeding the output device).
This issue does not appear when not using a studio audio interface (for example BT headphones), which makes me think that the Godot code makes big assumptions about the output device in the audio code that is not correct.
Ok an update. I did some work on this today and I believe that I have resolved this issue in my local build. Back to back testing with the official Godot 4.1 build and my local build, also testing with different Focusrite sample rates and the issue does not appear in my local build, while it occurs in the official build.
I have also tested with BT headphones and it also works there.
I modified the WASAPI driver quite a bit to resolve this issue. I also looked at the XAudio2 implementation but it doesn't build (probably why it is excluded from the build also), so I will not touch that. But I am very certain this issue would not have happened in the XAudio2 implementation if it was used for speaker playback.
Great work :slightly_smiling_face: Could you open a pull request on master
with your changes, please?
I also looked at the XAudio2 implementation but it doesn't build (probably why it is excluded from the build also),
The XAudio2 driver has been disabled by default for a long time, so it probably bitrot over time.
I have opened https://github.com/godotengine/godot/pull/81938 now. Probably did something wrong with the Git side of thing though. My least favorite part.
Hi, I just wanted to add that the issue with crackling audio is not exclusive to FocusRite stuff. I have the same problem with my Asus Xonar DSX sound card.
@crashfort Tested your PR with my Focusrite 18i8, and it had no differences regarding the crackling audio. The crackling always occurs regardless of 1 sound playing or 100 sounds playing, but it can't really be replicated easily as it seems to be at complete random.
Happy to help with testing as much as needed on this issue as this is a huge blocker to development of my current game, an audio-focused game
Edit: I don't know if this helps at all but the crackling sounds identical to what happens in Ableton when you have too many VSTs running at once, it's caused by using too much CPU. However, that shouldn't be happening in a project with pretty much nothing going on. Also noting that this issue does not seem to occur when not using the interface, but as others said before, that is pretty irrelevant since a high percentage of people use audio interfaces, especially Focusrite ones.
I have opened #81938 now. Probably did something wrong with the Git side of thing though. My least favorite part.
checked with my Focusrite mini, seems to fix it. cross checked with other versions of the engine and changing around buffer sizes still stutters with them, but with this one i couldn't get it to stutter across a few different configurations of 128/256/512 buffer size and 44100/48000 sample rate.
For what it's worth, I can confirm that this appears to also affect my Sennheiser GSP 670. I came across this issue while trying to play Halls on Torment. Some of the other reports on the forum finally pointed me towards this issue.
After reading the whole thread, just wondering if anyone has considered ASIO drivers/hardware as part of the root cause? That may be the commonality between all the devices mentioned.
After reading the whole thread, just wondering if anyone has considered ASIO drivers/hardware as part of the root cause? That may be the commonality between all the devices mentioned.
fix has already been mentioned here - #81938. im not too familiar with audio drivers but it seemed to be a problem with WASAPI.
but we need more people testing that branch to see if it really fixes it for most people.
idk if this would be relevant but I've been noticing this error message pop up:
" modules/vorbis/audio_stream_ogg_vorbis.cpp:332 - Burning negative samples doesn't make sense. Check seek algorithm."
@mberymon Can confirm that ASIO might be the issue.
Upper two channel is from godot build, lower two is original sound. I've synced start position thus difference in length proves that godot indeed has trouble.
Considering all the pop sound and overall slower playback suggest godot has trouble filling buffer or something.
Whenever Virtual ASIO is enabled (for me, Voicemeeter Banana) - despite having same sampling rate audio, even just playing track in editor's audio preview window has this issue.
If you disable exclusive mode for physical playback device then finally sound plays normally.
I wonder what's the cause though, never seen any other program having issue with Voicemeeter other than Godot.
Considering all the pop sound and overall slower playback suggest godot has trouble filling buffer or something.
Can you reproduce this if you increase Output Latency in the Project Settings (then restart the editor)?
I have this exact issue on my Windows PC, and Godot 4.1.3 is the only application that does that. I have several audio devices, including an external DAC (Steinberg UR12) and wireless headphones (Steelseries Artics 7, radio, not Bluetooth). This issue even persists with Remote Audio sound device via Remote Desktop connection.
Output Latency does not make any difference whatsoever (I suspect it doesn't even work). Changing Mix Rate to the same as or different from the current audio device does not help. ASIO drivers/devices are not used.
UPD: Unfortunately, the fix https://github.com/godotengine/godot/pull/81938 did nothing to resolve the issue.
UPD 2: Reinstalled Windows, this issue is not fixed.
@Calinou Yes actually first answer I saw on reddit suggested it, so I even set it as high as 200ms and still same issue happened, and still is.
Tried reinstalling VB again, no luck. Wonder if extra latency helps others with physical audio interfaces, as I don't have one.
Just to add to the list of devices this is affecting: got the same issues using my Motu M2 in 4.2, heavy crackling and an increasing delay over time. And just the same as others, no crackling when using a pair of headphones plugged straight into my PC, even when I remain using my microphone connected through the interface as an input in Godot.
Increasing Output Latency in the project settings doesn't have any effect, the same as messing with the sample rate or buffer size in my Motu drivers. Not sure if this is useful info but the issue also gets picked when screen sharing over Discord and when screen recording with OBS,
Hey, same here with my UMC22 Beheringer audio interface. Everything else works, tried all the sampling and ASIO settings, no fix provided works.
Just want to add that this is still happening. I have a SoundBlasterX G6 soundcard and no matter what I do, every single audio file I play in-editor or at runtime is totally busted. All audio tracks have random crackles and/or randomly cut out then back in. (It gets much worse if applying an AudioEffect like Reverb as well.) It makes the engine completely unusable for full projects. I've never had this problem with any other application on my PC, it's exclusive to Godot.
EDIT:
If you disable standalone mode for physical playback device then finally sound plays normally.
This actually fixed it! That is nuts lol. Thank you so much for this advice @jupiterbjy, though it would still be great for this to be fixed officially. It would suck to have to advise players to change a windows setting in order to play anything I make.
Also for anyone looking for the setting in English, the specific box to uncheck is labelled "Give exclusive mode applications priority." You can find it under the "Advanced" tab in any audio device's properties.
Also for anyone looking for the setting in English, the specific box to uncheck is labelled "Give exclusive mode applications priority." You can find it under the "Advanced" tab in any audio device's properties.
That's interesting, for me it seems to be the opposite. On my system, both exclusive mode settings were disabled. I first tried to only enable "Allow applications to take exclusive control of this device", with which the crackling persisted. I actually had to enable "Give exclusive mode applications priority" as well, and now I've been listening to an audio file for over 10 minutes without any crackling.
@ScarfKat glad it worked, and thanks for correct ENG terms there - Updated image!
Since that word can be translated to both way in korean I made a wrong choice I suppose haha
Considering @lander-vr needed to tick both option on unlike my case, wonder if there's something to do with Software ASIO vs Hardware.
So far my guess from this situations is:
We'd know for sure if we have enough devices and software ASIOs tested against this theory
Considering @lander-vr needed to tick both option on unlike my case, wonder if there's something to do with Software ASIO vs Hardware.
Coming back to my project the next day and the crackling is back. After trying each combination of those exclusive mode settings again, this time none got rid of- or affected the crackling. To make sure this wasn't something project-related, I tested in a new empty project with only an audio file imported.
Considering @lander-vr needed to tick both option on unlike my case, wonder if there's something to do with Software ASIO vs Hardware.
Coming back to my project the next day and the crackling is back. After trying each combination of those exclusive mode settings again, this time none got rid of- or affected the crackling. To make sure this wasn't something project-related, I tested in an new empty project with only an audio file imported.
After seeing this comment I went in and tried the same with my Focusrite 18i8 and this had no effect. The crackling is still there, always.
Coming back to my project the next day and the crackling is back. After trying each combination of those exclusive mode settings again, this time none got rid of- or affected the crackling. To make sure this wasn't something project-related, I tested in a new empty project with only an audio file imported.
Yeah unfortunately same here. The fix worked for a day, now I come back to the project and the audio is broken again. I'm also in the same boat of this being an engine-wide thing. It seems that this fix stops working after a PC restart. EDIT: Alright this time I had to disable both exclusive mode options, and now it's ok. Sucks that the only fix we have for now isn't entirely reliable though. It also makes troubleshooting what exactly is causing it a lot more tricky.
I've spent the last week trying to figure out the source of my audio issues, with audio slowing down, stuttering, and breaking up, before finally finding this issue today. What I read here sound exactly like what I experience. It is some what reproducible, in the sense that it usually occur some time during runtime every time I start my project. Sometimes it's there from the start, and sometimes it gets slower and slower, with more and more stuttering and breaking sound, before picking itself up again going back to normal. Changing audio interface always clear up the problem, and I haven't experienced the issue yet when running sound through my monitor via HDMI, but that I have only tested tonight after finding this thread. The problem also occurs in the editor, when playing my background music which last for more than a second or two.
Godot version: v4.2.1 OS: Windows 11 Pro USB audio interface: Focusrite Scarlett Solo (2nd gen)
edit: Added specification that the issue occurs on Windows, since I've now tested it on my MacBook Pro M1 Pro running macOS 14.1.2, using the same USB interface, without being able to reproduce the error.
I'm currently working on a game jam and can confirm I am also experiencing the issues on this thread. It seems to be fairly random when it will trigger. Can't seem to figure out exactly what the cause is. Thought I would throw my name in though as somebody who has also experienced the issue. I will note that when exporting the game, the final export does not have this issue. So it definitely has to do with Godot not properly reading the audio files or some weird audio parsing through audio interfaces.
Godot Version: v4.2.1 Audio Interface: Focusrite Scarlett 2i2 (3rd gen)
This happens to me too, using a 3rd gen focusrite 8i6. It also happens on exported projects including web. It seems to be very sporadic, and can happen at any point. I've turned off the exclusive control options for it and tried restarting my computer, but the issue is still there.
I'm trying to use the timestamp of the music for rhythm based stuff, but it gets messed up when the crackling/slowdowns happen. It's a blocker for making any kind of rhythm based game.
Chiming in to add that this is happening to me as well on a Motu M4 audio interface, Godot v4.1.2, Win 10 Pro. No messing around with driver buffer size or project audio latency has helped. Godot Editor and my Godot game are the only apps I have ever seen this problem with on this PC.
Had a friend report this was happening to him with my game (built with v4.2.stable.mono.official [46dc27791]) on his Windows 11 setup which is "RME digiface to optical digital, and from there to a DA converter".
I encountered this problem while creating a game. On short sounds this is not noticeable at all, but during music, lags occur at random times. I have a Steinberg UR22C sound card (I tried everything suggested above, it didn’t help) I’m really looking forward to the fix, because sound is very important
Godot version: v4.2.1 OS: Windows 11 Pro USB audio interface: Steinberg UR22C
Chiming in to report the same issue, very distorted audio.
Godot version: v4.2.1 OS: Windows 11 Pro USB audio interface: Focusrite 4i4
Same issue here. The build from @crashfort fixed the audio problem, but there are several other engine bugs in that godot build, so I can't use it. I noticed that reconnecting the DAC (unplugging and plugging it back in) fixes the distortion for a while, without needing to restart the engine.
Godot: 4.2.1 OS: Windows 11 Home Interface: Focusrite Scarlett Solo 3rd gen
Some press about this bug:
I also got the same behaviors. Music would slow down, distort, cracks and pops.
Godot 4.2 Compatibility Win 10 Focusrite 2i4 Gen1 44.1 kHz/ 24 bits stereo wav files with Loop mode forward and no compression
https://eddie-yu.itch.io/music-player Here's the HTML5 version, the behavior would happen in the editor, test run, Window build, HTML5 build. Sometime it happens, sometime it doesn't, sometime it persists, sometime it goes away eventually.
I played some Godot games that suffer from this like BackSlash. While there are lots of Godot games that don't seem to have this issue like The Case of the Golden Idol and Donut Dodo.
I played some Godot games that suffer from this like BackSlash. While there are lots of Godot games that don't seem to have this issue like The Case of the Golden Idol and Donut Dodo.
Case of the Golden Idol and Donut Dodo both released in 2022, using an older version of Godot from before when this bug was introduced in January 2023 if @MJacred is correct that the regression happened between Godot 4.0 beta 14 and Godot 4.0 beta 15.
But BackSlash released in 2017 so if that also has a Godot audio bug it may be from a much earlier version of Godot.
Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.
Godot version
Godot 4.0 stable
System information
Windows 10
Issue description
I have been having inconsistent bugs with audio files being played weirdly in Godot, as if Godot can't read them correctly.
I made a project that worked completely fine, and then in some way when I switched some audio files the audio started stuttering. I tried many different formats but nothing really worked. This can happen both when you preview the sound in the inspector and in game. Switching to a new project, with the same file, the audio worked fine again for a few minutes until it started stuttering again. So I think its more about the engine somehow messing up with how it reads the files. Reopening the projects seems to fix this sometimes.
I tried recreating what could make this happen but couldn't really find a reason, but its still happening, with old/new projects, although again inconsistently changing between stuttering and working normally, with all types of files.
I tried with 32bit float, 24bit int, and 16bit int .wav files, mp3 320kbps, all at 44.1khz.
Obviously the files themselves are not corrupted as if you play them externally they sound just fine. My audio is fine anywhere else outside of Godot, so I don't think its a problem with my setup.
Steps to reproduce
Just try dragging in audio files into Godot and preview them in the inspector, see if anything happens I guess. As I said, this is pretty inconsistent so I don't know how to reproduce it. It happened to me in a brand new project, as well in a project that I have been working for a few hours on.
Currently I can't reproduce it for some reason, if it comes back again ill try recording it.
Minimal reproduction project
N/A