Loop music

Hello everyone,

I’m seeking for a way to properly loop my music into a basic level.

Do you have some clues ? Thank you very much.

I’m little unclear on what the question is.  Are you asking about the mechanics of looping sounds, or for best practices?

Assuming mechanics…

First, Please check out the audio spec/docs for playing and looping sounds.

https://docs.coronalabs.com/daily/api/library/audio/index.html

Second, be aware, there are two basic categories of sounds:

  • short ones (1…5 seconds) used for sound effects.  Use audio.loadSound() followed by audio.play() for these.
  • long ones  usually music and sound tracks.  Use audio.loadStream() followed by audio.play() for these.

In either case, you specify looping in the audio.play() call: https://docs.coronalabs.com/daily/api/library/audio/play.html#loops-optional

Yes, I’m sorry, my question wasn’t clear enough. Indeed, I meant mechanics and thank you for the answer :slight_smile:

Actually, I seeked for a “proper way” to loop a music, without any breaks between the end and restart of the music but it looks like already fine.

I’m little unclear on what the question is.  Are you asking about the mechanics of looping sounds, or for best practices?

Assuming mechanics…

First, Please check out the audio spec/docs for playing and looping sounds.

https://docs.coronalabs.com/daily/api/library/audio/index.html

Second, be aware, there are two basic categories of sounds:

  • short ones (1…5 seconds) used for sound effects.  Use audio.loadSound() followed by audio.play() for these.
  • long ones  usually music and sound tracks.  Use audio.loadStream() followed by audio.play() for these.

In either case, you specify looping in the audio.play() call: https://docs.coronalabs.com/daily/api/library/audio/play.html#loops-optional

Yes, I’m sorry, my question wasn’t clear enough. Indeed, I meant mechanics and thank you for the answer :slight_smile:

Actually, I seeked for a “proper way” to loop a music, without any breaks between the end and restart of the music but it looks like already fine.