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

static is emitted when freeing an AudioStreamPlayer or resetting its stream property #25087

Closed
girng opened this issue Jan 18, 2019 · 8 comments · Fixed by #51296
Closed

static is emitted when freeing an AudioStreamPlayer or resetting its stream property #25087

girng opened this issue Jan 18, 2019 · 8 comments · Fixed by #51296

Comments

@girng
Copy link

girng commented Jan 18, 2019

Godot version:
ce36351

OS/device including version:
Windows 10, 64-bit. Default High Definition Microsoft Audio Driver (last update 9/7/2018)

Issue description:
When calling stop(), queue_free(), or setting stream = null on an AudioStreamPlayer, an audible static is heard at the end. this sound can be heard from your left or right ear (it's random).

Steps to reproduce:

  • Turn up your volume a bit
  • Run the attached demo
  • Listen for about 2-4 seconds to get the stream warmed up
  • Click the Button to stop the stream
  • You'll hear a small static.

Minimal reproduction project:
audiostreamstopbug.zip

i'm am not sure if this is only with .ogg files, will test some more. at the moment, i don't think i can replicate this with .wav

@girng
Copy link
Author

girng commented Jan 18, 2019

okay so i've been fiddling around with this for an hour or so. finally found something that stops it. but i know this can't be a solution it feels too hacky

	audiostreamplayer.stream_paused = true
	yield(get_tree().create_timer(0.2), "timeout")
	audiostreamplayer.stop()

when stream_paused is toggled, the static doesn't happen

i think the "fading out" comment is important here: that fading out helps with the static?

// Node can't process so we start fading out to silence

this is about as far my brain goes with c++ 🔮

edit2: might be around here

if (!stream_playback.is_valid() || !active)

@heraldofgargos
Copy link

I can't seem to replicate the issue (used your zip file). I presume this has more to do with your audio driver as opposed to Godot's audio API?

@girng
Copy link
Author

girng commented Jan 18, 2019

@alexfonseka just curious what OS? i don't think it's my audio driver cause the pausing of the stream works fine with no static. just the abruptly stopping (.stream=null, .stop(), or .queue_free()) causes the static.

@heraldofgargos
Copy link

Okay so I get the pop when using the default audio driver but its random. I don't hear the pop at all when using my external DAC. I'm on Win 10.

I remember experiencing a similar issue with Love2d engine as well. Starting the audio event paused does seem to fix all of the static noises/pops.

@marcelofg55
Copy link
Contributor

Since #25974 was just merged the stop() part of the bug should be solved, please confirm and update the issue, thanks!

@akien-mga
Copy link
Member

Confirmed that stop() no longer seems to trigger this bug (so the MRP in the OP doesn't either).

queue_free() and stream = null still trigger it.

@akien-mga akien-mga changed the title static is emitted when stopping an AudioStreamPlayer static is emitted when freeing an AudioStreamPlayer or resetting its stream property Apr 7, 2019
@akien-mga
Copy link
Member

#25974 was reverted, but the bug was fixed again for AudioStreamPlayer in 040b59c. Can anyone confirm that the bug seems fixed in the master branch?

Can you reproduce the bug with AudioStreamPlayer2D and/or -3D which didn't get the fix?

I tried myself and it seems fixed, but I don't have very precise hearing and I don't know if the relatively abrupt end of playback is just the playback stopping or actually the "static" mentioned here. From what I hear it AudioStreamPlayer seems good, but for AudioStreamPlayer2D I'm not sure.

@KoBeWi
Copy link
Member

KoBeWi commented Sep 26, 2019

AudioStreamPlayer2D/3D still clicks in all cases.

AudioStreamPlayer still clicks on queue_free(), otherwise is fine.

EDIT:
Same in 443686d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants