Open emberlightstudios opened 10 months ago
Add an AudioStream3d node Add an AnimationPlayer node Add a Camera3d node Add an audio stream to the player node and set to autoplay. Create a new animation with 2 keyframes attenuating the volume from 0db to -80db. Set the animation to autostart or play it from script.
I followed these steps but can't reproduce your issue using ogg or wav sound files. (Win 10. Godot 4.2.1 stable)
Edit: I checked your MRP and the cause is you having the Camera3D at the exact same position as the AudioStreamPlayer3D. To "fix" this, either move the Camera3D or the AudioStreamPlayer3D so they are not at the exact same position, or use a AudioStreamPlayer (which is not positional).
Yes that worked. Thank you.
Not sure I ever would have figured that out on my own.
I assume this is because the loudness scales like 1/distance or 1/distance^2 or something like this. It might be worth considering changing it to 1 / (distance^2 + epsilon) to avoid this behavior. I don't think anybody would ever actually want volume control to be disabled.
Tested versions
Reproducible in 4.2.1
System information
Windows 11
Issue description
When I animate the volume on an audio stream player it only works in the editor, does not work when the game is launched.
Steps to reproduce
Create a scene Add an AudioStream3d node Add an AnimationPlayer node Add a Camera3d node Add an audio stream to the player node and set to autoplay. Create a new animation with 2 keyframes attenuating the volume from 0db to -80db.
Set the animation to autostart or play it from script.
Test in Editor: Set the streamplayer to "playing" and scrub the timeline. The volume does change. Disable "playing"
Test in Game: Launch the scene. The volume does not go down. In the remote scene tree the volume property has changed, but the actual volume coming out of the speakers does not change.
EDIT: Actually, doing more testing, it seems the volume property does not work in game at all, animated or not. If I set a stream to just be at -80 db and start the scene with no animation, it still plays at full volume.
Minimal reproduction project (MRP)
test.zip