Trying to make audio play continuously

Im using 1.19 and I’m trying to find a way to play audio continuously on a frame unless frame is left, y’know, play the audio, and if it stops, play It again. I’m no pro to javascript programming so I tried doing some stuff like playing the sound on update but that didn’t go well. So I went to StackOverflow to help me, I came across this post How to play a sound continuously without break? 6YRS 11MTHS and I tried modifying to so it would work on wick but nothin. So I came to the forums for help. So if you have a better way please tell me.

if you want to loop a sound, you can use playSound("yoursound.wav", {loop: true});. this will loop from the end back to the start.

if you don’t want to loop from the very end to the very start, you can write some extra code to loop from and to anywhere, even the middle.

I used this code from Jovanny to loop a song seamlessly, without looping an intro.

take a look at the sample code for a bit to get used to how it works. you can ignore the loop() function if you are trying to loop in the middle.

to loop the audio, you can use seek() to detect when you reach a certain point in the song. when that is detected, use seek() again to move it back to wherever you want the loop to start. you can use play(), stop(), or pause() to control if the song is playing.

2 Likes

Thanks man, your the best