Changing the load behavior to ‘ForceInline’ in the soundwave asset is what finally worked 100% for me.
I’m seeing this issue in 4.27.2
No clear solution so far. Have been trying everything in this thread and looking at others. It may be an issue with the audio thread having lower priority as mentioned in this older thread? Delayed Audio in 4.15? - #16 by Juice-Tin Any help is greatly appreciated!
It was my Callback Buffer Size that was causing the issue if anyone else runs into a similar one. I had increased it when debugging a separate issue and it added a delay in audio playback.
Confirming that changing the “Loading Behavior Override” property to “Force Inline” in the Sound Wave files fixed the delay. Tested in UE 5.1.1 in the editor and in a Shipping packaged build.
Tip: To change the setting for all your Sound Wave files at once without having to open and edit them all one at a time, first select them all in the Content Browser, then Right Click → Asset Actions → Bulk Edit via Property Matrix, select all the rows in the list and then on the right-side menu edit the property under the Loading category to modify them all. Then File->Save All
Force inline causes very quick noises (e.g UI ticks) to corrupt and sound like various static beeps and scratches instead. Which ironically are the types of sounds where the delay is most obvious as they’re isolated and directly in response to player input.
It probably depends on compression as well, as it doesn’t happen to all short sounds (or perhaps they have enough silence at the end)
Unfortunately, the “Force Inline” option produces unacceptable bugs. Sometimes the sounds get distorted. Sometimes a single gunshot can turn into two gunshots, and so on. It yields unpredictable results.
Switching to MetaSounds doesn’t seem justified for my project at the moment. I hope the lag issue will be fixed and AudioCue will be fully functional again.
I found that the “force inline” option gives some errors with the PCM or ADPCM compression options. If you set the “Bink Audio” compression option in the project, the problems seem to disappear. Maybe this will help someone.
Noticed this line in the new V5.2 patch notes:
SoundWaves no longer synchronously load during USoundWave::PostLoad on packaged builds.
Seems potentially related to this issue; has anyone noticed a difference in behavior?
5.2 has the same delay.
My solution is to prime sound manually in the blueprint right before access if sound sync is critical.
I just started playing around in ue, but priming does not seems to work for me, there is still good 1 sec delay at first time. Is anyone found a foolproof solution?
Been struggeling with these annoying inital delays for a long time now.
I tried:
- Tempering with the stream caching
- Reducing callback buffer size
- All loading behaviors with all compression types
- Manually primeing sounds like @hirsch4700
- Changing sequencer clock source
Nothing works. I’m doing this with the wave file directly, not using any cue.
I’m basically trying to play a song via sequencer and use keyframes to do some visual effects that fit to the beat of it.
The audio is always slightly behind because of the initial loading delay.
A dirty way to maybe fix this would be starting to play the audio outside of sequencer but without volume and then playing it again. (which would basically be the job of the prime for playback node but it doesnt seem to work)
I’ve seen people mentioning quartz so that might be the last resort. I will give that a try soon but i guess i will have to do all my effects and movements manually then since i’m not sure how/if i can use sequencer keyframes synced up with quartz.
Maybe @dan.reynolds can enlighten me with his knowledge since he seems to be focussing on audio.
Funny, the UE Devs still not managed to fix this bug.
Same problem, Play any sound still delay when first play.
Little update:
quartz clock works fine for me. The problem is for my use case its a bit limited and complicated to handle. (For example its not easy to determine where exactly in the song i am right now if i want to do some special effects on specific drops/parts)
I might have found a solution for the sequencer as well which seems to work.
In the settings of your audio set it to “retain on load”.
Then use the “prime sound for playback” node and choose the audio. From the sound loaded event you can start the sequencer and it should be in sync, even if you put the audio directly into sequencer.
I’m still a bit worried that it might not be 100% in sync all the time but i’ve sent simple test projects to some friends and the delay seems to be gone.
TLDR: set the sound to retain on load and then prime the sound before playing it.
Confirmed that “retain on load” combined with priming the SoundBase (UGameplayStatics::PrimeSound) before playing results in no delay on packaged builds in 5.3.1.
Until now, I was using the “force inline” load behavior, which seemed to be working with no problems on my environment, but I think I’ll switch to “retain on load” since other people in this thread were reporting audio bugs when using “force inline” - although I wasn’t able to confirm such bugs myself.
Edit: Although there doesn’t seem to be any noticeable difference in audio quality/behavior between “Force Inline” and “Retain on Load + PrimeSound()”, I measured a ~20% overall slower loading time when all sound data is set to “Retain on Load” compared to if it is set to “Force Inline”, for the first time when entering gameplay in PIE in-editor. So I’m switching back to Force Inline to speed up the initial load after starting up the editor.
Glad that it works for you too! It seems to be a reliable solution then.
I try to avoid force inline completely because as soon as i play sounds via cue it heavily distorts them.
I’m just curious, but have any of you tested this with Bluetooth?
I found that it was because of the Bluetooth that I had a delay.
But sounds are played in blueprints cause they are combined with an function, for example jump sound
The delay has nothing to do with the Engine.
It’s the Bluetooth.
So, anyone wearing wireless headphones is going to experience lag.
Sorry, that’s not what’s going on here. Not everyone uses bluetooth headphones and we’re specifically talking about the first time a sound is played having a delay, not sound being delayed in general.