-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
AnimationTree state machine causes glitchy sound when triggering playing
of AudioStreamPlayer3D
#95684
Comments
Bisecting points to #86629 as the culprit: |
Dupe of #89730, this is not bug. However, it might be better to have some warning so that users do not use it. |
The docs state that FORCE_CONTINUOUS does this:
I take it this is not true and the docs need to be updated as well? Or is a bool considered a numeric type? I don't fully understand what is happening under the hood, or all the scenarios like imported animations, but when I add property tracks for bools they automatically get added as discrete, and when I add tracks for floats or vectors they automatically get added as continuous. Treating the track's discrete/continuous mode as the source of truth for blending rather than overriding it seems more intuitive to me. That's assuming a continuous mode track blended with another continuous track mode track will be blended without artifacts, even if recessive/dominant mode is selected? |
Yes. So the document should be more accurate to say that it is un-interpolatable than non-numelic, as the bool is treated internally as a number, as 0 or 1 when blended. Perhaps the documentation could be updated to clarify this. |
Ok thanks, that explains what is happening. I don't understand why FORCE_CONTINUOUS is the new default, the tracks seem to know perfectly well whether they are continuous or discrete already without needing to override it. But I don't have the bigger picture and I don't really know what problem FORCE_CONTINUOUS was trying to solve in the first place, so please feel free to disregard and close this issue. |
This is because the default for int values is Discrete, and several issues have been raised in the past about int not being interpolated/blended smoothly in AnimationTree, even though it is possible to interpolate it as a float. There are so many people who don't know the difference between Discrete and Continuous+Nearest, see also https://godotengine.org/article/migrating-animations-from-godot-4-0-to-4-3/#callbackmodediscrete. Godot 5 will absolutely needs that interpolatable values default to Continuous+Nearest instead of Discrete. |
Is this a tradeoff that will make more work in-engine to implement animation-timed audio or can the engine be tweaked to better accommodate for more immediate implementation of audio like it had been previously? What steps need to be followed in engine to restore the one-shot audio playback? Changing the audio's timeline settings to discrete+nearest doesn't change the effect. |
@wolcamophone DiscreteMode ignores InterporationType, so Discrete+Nearest makes no sense. Also, I never recommended that anyone set Continuous+Nearest for AudioStreamPlayer. I explained that if you want to use AudioStreamPlayer.playing and Discrete, you need to “set CallbackModeDiscrete in AnimationMixer to Recessive or Dominant”. The PR to add that warning is #95711 but not yet merged. |
For others who might see this, the solution I went with for my project was changing to audio playback tracks instead of using |
Tested versions
Reproducible in 4.3, not reproducible in 4.2
System information
Godot v4.3.stable unknown - Arch Linux #1 SMP PREEMPT_DYNAMIC Sun, 11 Aug 2024 16:19:06 +0000 - Wayland - GLES3 (Compatibility) - AMD Radeon RX 6800 XT (radeonsi, navi21, LLVM 18.1.8, DRM 3.57, 6.10.4-arch2-1) - AMD Ryzen 7 5800X3D 8-Core Processor (16 Threads)
Issue description
If you have an AnimationTree with a state machine that triggers the
playing
property on an AudioStreamPlayer3D in a keyframe, the audio becomes glitched, sounding as if it is constantly restarting from the first sample every frame. Just load up the MRP to see it in action; works fine on Godot 4.2, glitches audio in Godot 4.3.Steps to reproduce
play the MRP
Minimal reproduction project (MRP)
animtree_audio.zip
The text was updated successfully, but these errors were encountered: