0 votes

Hey All,

I have done this >100 times and never had this issue. I have an AudioStreamPlayer with a .wav file in the stream. In the editor, if I press playing/set it to true, I hear the sound just fine. For some reason, however, calling AudioStreamPlayer.play() from code makes no sound in-game.

It gets weirder... as a test, I connected the AudioStreamPlayer's "finished" signal and told it to print when the _on_finished() function ran... and it did. So it is playing, but there is no sound?

I tested sounds from one of my old games and they played fine, so I think it is the sound file, but it's very weird to me that it plays in the editor but not in-game.

Any Ideas???

Godot version 3.2.4 beta 4
in Engine by (608 points)

An idea: did you check audio buses, the default layout, maybe a script mutes a bus?

Are you playing your sound on a autoload singleton or on a node in the scene tree?

4 Answers

0 votes

Maybe you are playing the music in the physics_process? What happen is it continuously play over and over that you can't hear.
What you do is you add a boolean:

if AudioStreamPlayer.playing == false:
by (387 points)
+1 vote

I had the same issue, if you are using a viewport, you must go into the viewport settings and under 'Audio Listener' enable 3d audio.

by (16 points)

This solved my issue, thank you!

0 votes

@ Mrpaolosarino has suggested one reason why this can happen but I will mention another reason this can happen.Do not forget the max_distance property which as the name implies controls the range at which the sound can be heard from a player's position in the scene.So increase it if you don't hear any sound or just position the audiostreamplayer close to the player.

by (28 points)
edited by
0 votes

The problem was had to do with the way my audio program (Traction Waveform) was exporting the .wav files. If I "edited" and exported the files in audacity, the issue went away.

Also, this was 2D.

by (608 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.