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 plays incorrectly from a StateMachine (regression 4.3.dev4) #89730

Closed
dandeliondino opened this issue Mar 21, 2024 · 2 comments
Closed

Comments

@dandeliondino
Copy link

dandeliondino commented Mar 21, 2024

Tested versions

  • Reproducible in 4.3.dev4 and 4.3.dev5
  • Not reproducible in 4.3.dev3 and 4.2.2-rc2

System information

Godot v4.3.dev4 - Windows 10.0.22621 - GLES3 (Compatibility) - NVIDIA GeForce RTX 3080 Laptop GPU (NVIDIA; 31.0.15.4633) - 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz (16 Threads)

Issue description

An AudioStreamPlayer with playing=true in a AnimationPlayer animation plays back incorrectly when the animation is played from a StateMachine inside an AnimationTree. It sounds like it may be a buzz of the first milliseconds on repeat.

Videos of the MRP (audio from Kenney's Music Jingles):

godot-4-3-dev3.mp4
godot-4-3-dev4.mp4

Things that don't change the outcome:

  • Using a different audio file, or encoding as OGG vs WAV
  • Setting the animation track, AudioStream and/or the AudioStreamPlayer to loop
  • Changing the AudioStreamPlayer to AudioStreamPlayer3D
  • Changing the StateMachine transitions
  • Whether the AnimationTree is set to deterministic
  • Adding the AudioStreamPlayer's track to all animations

Note: This project incidentally triggers the spurious _transition_to_next_recursive error from #82935, so I also tested with #89575, and can confirm that PR fixes the error (and, as expected, reproduces this bug).

Steps to reproduce

  • Create an AudioStreamPlayer and assign an AudioStream. Note that it plays back correctly in the Inspector.
  • Create an AnimationPlayer. Create a new animation, add a track for the AudioStreamPlayer's playing property and set it to true. Note that it plays back correctly when the animation is played.
  • Create an AnimationTree. Set the Anim Player path to the AnimationPlayer. Create a StateMachine node. Add the animation with the audio track to the state machine. Note that it plays back incorrectly when the StateMachine node is played.

Minimal reproduction project (MRP)

state-machine-audio.zip

@TokageItLab
Copy link
Member

Setting CallbackModeDiscrete to Dominant will provide the expected behavior.

image

However, this will still cause the audio to be interrupted by changing the stream to play when the state is changed. This is the intended behavior for ValueTrack. So, it is recommended to use AudioTrack for audio playback in the first place. AudioTrack has a Don't Use Blend property for that use cases where the playback stream exceeds the animation length.

image

@TokageItLab
Copy link
Member

Closed by godotengine/godot-website#851

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

3 participants