Page 1 of 1

Not a seamless music loop. [solved]

Posted: Fri Sep 23, 2016 8:46 am
by warmsundae
When a song loops in my game, there's always a split second break between the loops. Is it because it's getting ready for the next repeat or something? Could someone explain why that happens, and maybe even how I could fix it?

Re: Not a seamless music loop.

Posted: Fri Sep 23, 2016 9:54 am
by indoneko
Just to make sure that the error is not on the music file itself, have you tried playing the song in windows media player (or whatever multimedia player is available in your system) and confirmed that if it loops seamlessly?

Re: Not a seamless music loop.

Posted: Fri Sep 23, 2016 10:11 am
by warmsundae
Just tested it again, and yeah, I'm pretty sure it's smooth. I also made sure there isn't too much release at the end so the loop isn't jarring. This happens in all my games. Is it just me?

Re: Not a seamless music loop.

Posted: Fri Sep 23, 2016 10:16 am
by Donmai
What audio format are you using?

Re: Not a seamless music loop.

Posted: Fri Sep 23, 2016 12:37 pm
by indoneko
When you said that it happens in all your games, does it also hold true for renpy's demo game (and any renpy games made by other people)?

If it's true, I suspect that there's something wrong with your system. I supposed you could try to play your game on another computer to see if the problem persist.

Otherwise, you might want to put your code here so that others can point out where the mistake is.

Re: Not a seamless music loop.

Posted: Fri Sep 23, 2016 9:14 pm
by warmsundae
Actually, it seems fine on "the Question". I don't use any code beyond the script to play the song, so here:

Code: Select all

play music "droplets.mp3" fadein 2.0 fadeout 1.0

Re: Not a seamless music loop.

Posted: Fri Sep 23, 2016 9:52 pm
by Divona
warmsundae wrote:Actually, it seems fine on "the Question". I don't use any code beyond the script to play the song, so here:

Code: Select all

play music "droplets.mp3" fadein 2.0 fadeout 1.0
Have you try remove

Code: Select all

fadeout 1.0
I usually only use that when I stop playing the audio.
Actually, remove all the fade, does the audio loop seemlessly?

Re: Not a seamless music loop.

Posted: Sat Sep 24, 2016 2:50 am
by indoneko
In practice, fade-in/out only has effect on the first and last iterations of the loop, so your song should still loop seamlessly in between. But I agree with Divona's suggestion : try removing the fades and see if it has any effect.

And since "The Question" can run smoothly (which also means that there's no problem with your system), could you try replacing your game's song with any music files from that demo game? If it loops seamlessly, then the culprit was your original song. You can also do different test by making a new project (just let it as the default, don't write anything on the script.rpy yet) and add this line in the new project's options.rpy (it will play your original song as the game menu's BGM) :

Code: Select all

config.main_menu_music = "droplets.mp3"
If you have changed your original music with the one from "The Question" but the problem still persist, then you might have mistakenly added unnecessary line(s) in your script file(s) which leads to some kind of delay between loop.

Re: Not a seamless music loop.

Posted: Sat Sep 24, 2016 6:21 am
by warmsundae
I put the demo song into my game and it worked perfectly. I hadn't looped mp3 form of the song in anything other than logic pro, which was what I created them with, and I don't know any other looping media players. But I tried iTunes. If iTunes doesn't have a break between songs, then it means that there's a break at the end of the song, though I don't know why.

I guess I'll be trying to fix that on my own. Thanks for all the replies!

edit: Actually, it works fine in iTunes if I put it in a playlist. I've tried cutting the end of the song but it's not fixing anything. Okay, back to the drawing board.

Re: Not a seamless music loop.

Posted: Sat Sep 24, 2016 6:57 am
by indoneko
You're welcome~ :3

The break/silence at the end of the song can be easily eliminated by using wave editor like Audacity. Good luck!

Re: Not a seamless music loop.

Posted: Sat Sep 24, 2016 10:54 am
by J-Ray
If you're trying to make music really "seamlessly" like one piece playing without pauses - you have to use OGG, not MP3.
MP3 will break seamless connection between end and start.
The reason why I keep all the sounds in my free library in OGG format:
http://www.julianraymusic.com/sound/soundblend/main.php

Re: Not a seamless music loop.

Posted: Sat Sep 24, 2016 12:14 pm
by Donmai
J-Ray wrote:If you're trying to make music really "seamlessly" like one piece playing without pauses - you have to use OGG, not MP3.
This. That's why I made that unanswered question before.

Re: Not a seamless music loop.

Posted: Sat Sep 24, 2016 10:21 pm
by warmsundae
Oh wow! Okay, I'll try that.

Yeah, it works. That was an easy fix, thanks so much.

Re: Not a seamless music loop.

Posted: Sun Sep 25, 2016 8:55 am
by J-Ray
warmsundae wrote:Oh wow! Okay, I'll try that.
Yeah, it works. That was an easy fix, thanks so much.
You're welcome!