Topic was automatically imported from the old Question2Answer platform.
Asked By
scrubswithnosleeves
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???
An idea: did you check audio buses, the default layout, maybe a script mutes a bus?
1234ab | 2021-04-02 16:49
Are you playing your sound on a autoload singleton or on a node in the scene tree?
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:
AudioStreamPlayer.play()
@ 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.
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.