How to make soundtrcak loop?

I’m using a code to make the same music play in all scenes
However, the music doesn’t loop once it ends/ how can I correct this?

1. * extends AudioStreamPlayer


2. * const level_music = preload("res://Sounds/Cozmo_Title.wav")

3. * func _play_music(music: AudioStream, volume = 0.0):
4. * 	if stream == music:
5. * 		return
6. * 	
7. * 	stream = music
8. * 	volume_db = volume
9. * 	play()
10. * 	
11. * func play_music_level():
12. * 	_play_music(level_music)

I think you have to import the track with “loop” set to true

1 Like

How can I do this?

you can just double click the mp3 file of your track, then set “Loop” enabled

I can’t change it
image

no like via FileSystem

What’s this?

its where you see the files in your game folder

You mean this? If it was, then it still won’t work
image

click on the track an then on the “import”-tab on the top left

1 Like

You can loop only OGG-formatted files in extended import settings

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.