godotengine / godotengine/godot
`AnimationTree` and `AudioStreamPolyphonic` is not optimized for audio playback as it plays audio at zero volume
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in v4.2.1.stable [b09f793f5]
### System information
Godot v4.2.1.stable.mono - Windows 10.0.22631 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 3070 Ti (NVIDIA; 31.0.15.4629) - 12th Gen Intel(R) Core(TM) i5-12600KF (16 Threads)
### Issue description
Audio clips seem to have weird behavior when used in a blendspace2D with sync enabled. Sometimes the audio refuses to have its volume changed and has weird timing. Other times the audio does blend properly and causes audio to either pop and crackle because it reaches the max_polyphony or plays the sound completely with no volume change ,when it shouldn't be either muted or at not playing at all. After a while it also seems to kill the audio server if there are a lot of different sound effects in the animations (likely because it overflows??)
Example video of the max_polyphony being reached causing the audio to pop and crackle while technically the selected animation in the Blendspace2D has no audio
https://github.com/godotengine/godot/assets/29980512/367cdf31-f6ae-466f-bb6c-a9cc93927032
What should be happening in the video is that no audio should be playing because the animation on that point has no audio clips only the neighboring points should have their audio playing at -80DB while the other points only keep track of the current position in their respective animations.
### Steps to reproduce
1. Create a AudioStreamPlayer3D, AnimationPlayer, AnimationTree
2. In the AnimationPlayer create 2 animations 1 with an audio clip track and 1 without
3. In the AnimationTree create a BlendTree with a BlendSpace2D connected to the output
3. Place 4 points of the animation with sound at the top, bottom, left, right and place the animation without sound in the middle
4.Enable sync
### Minimal reproduction project (MRP)
[AudioClip issue in blendspace2D.zip](https://github.com/godotengine/godot/files/14106130/AudioClip.issue.in.blendspace2D.zip)
Contributor guide
Research direction
Start by running the linked minimal reproduction project and follow the AnimationTree BlendTree and BlendSpace2D setup with sync enabled. Inspect how AnimationPlayer audio clip tracks and AudioStreamPolyphonic behave when neighboring animations are at -80 dB or have no audio, including the AudioStreamPlayer3D and audio server behavior. Done means silent points do not continue playing or consume max_polyphony, while neighboring clips retain correct timing and volume.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- audio-video-rtc, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100