I imported a .wav file to use it as sfx in a scene, my issue is that that sounds just plays once instead of being looped until a timer runs out.
Basically it's the sound of a fuse for a bomb, until the timer sends the signal the sound should stop playing and play the explosion sound.
Attached the images, on how i imported the file, both in the import tab and the inspector tab have the loop option active, i don't know what else i need to make the sound loop.
Can't loop sound
You can probably make the sound loop through GScript and the finished
signal. Something like this:
extends AudioStreamPlayer
export (bool) var loop_sound = true
func _ready():
connect("finished", this, "_on_finished")
func _on_finished():
if loop_sound == true:
play();
Then you can trigger it to start playing like a normal AudioStreamPlayer. Though, having the loop option selected should make the audio loop. Maybe its a bug? If there is not one already open on this issue, it might not be a bad idea to open a bug report on the Godot GitHub (I didn't see any issues on the topic, but I only took a brief look). If you can, a minimum replication project that shows the bug would also be so developers can see if the bug is fixed, but is not required.
Did you re-import after activating the loop option?
@bitshift-r said: Did you re-import after activating the loop option?
yes, didn't work
@TwistedTwigleg said: You can probably make the sound loop through GScript and the
finished
signal. Something like this:extends AudioStreamPlayer export (bool) var loop_sound = true func _ready(): connect("finished", this, "_on_finished") func _on_finished(): if loop_sound == true: play();
Then you can trigger it to start playing like a normal AudioStreamPlayer. Though, having the loop option selected should make the audio loop. Maybe its a bug? If there is not one already open on this issue, it might not be a bad idea to open a bug report on the Godot GitHub (I didn't see any issues on the topic, but I only took a brief look). If you can, a minimum replication project that shows the bug would also be so developers can see if the bug is fixed, but is not required.
seems like a workaround but okay, will try later that
Could it be that 100000 for the loop end is too large a number and it is looping but just taking a long time before it replays?
@Megalomaniak said: Could it be that 100000 for the loop end is too large a number and it is looping but just taking a long time before it replays?
Yeah you are right, well more or less, the sound kinda extends a bit and then dies, but no what i had in mind, still, im gonna try a few more times.
Also as a sanity check try using an audio file in another format, ogg perhaps?
yes, the file .wav
Was the loop end set manually?
@2dvoxel said: yes, the file .wav
Thing about it is that there are multiple formats to wav Microsofts is just one, but your file might be in the apple format or any other. They aren't the same.
@SIsilicon28 said: Was the loop end set manually?
yes