godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.53k stars 21.26k forks source link

Playing multiple AudioStreams together causes alterations of pitch or volume #96249

Open Kadmioo opened 3 months ago

Kadmioo commented 3 months ago

Tested versions

System information

Godot v4.3.stable.mono - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2080 Super with Max-Q Design (NVIDIA; 32.0.15.6081) - Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz (16 Threads)

Issue description

This audio bug is hard to spot. When multiple AudioStreamPlayers play different AudioStreams, the pitch or volume of certain frequencies of the AudioStream get altered. I've provided a video below to show the issue better.

https://github.com/user-attachments/assets/11866800-dc11-4011-97f2-3ee54e52349f

In the video, a brownian noise is played constantly, with no major change in pitch or volume. When a pluck sound effect is played, however, you can hear the pitch of the brownian noise get very slightly altered. I suspect this happens to the audio frequencies shared by both sound effects, as it is easier to spot this bug if two AudioStreams have a very similar pitch range.

Steps to reproduce

  1. Start with a scene of your liking
  2. Add two AudioStreamPlayers
  3. Add two AudioStreams to the Players. (I recommend using a constant audio sample and a short sound effect, like a pluck)
  4. Play the AudioStreamPlayers, and make sure both AudioStreams are audible at the same time
  5. Try to spot the alteration in audio/volume

Minimal reproduction project (MRP)

audio-pitch-issue.zip

This is the same project I've used in the video. To replicate the issue, simply set the "playing" property of the first AudioStreamPlayer to True, and then do the same to the second one. The bug happens both in editor and in the running application.

nack098 commented 2 months ago

It's really hard to see the different but what I heard was the pitch did went down after the pluck right? Please correct me if I'm wrong.