Music makes a clicking noise when it starts looping

I am using loopable BGM for my game and I've noticed that in both Audacity and the RPG Maker Sound Test the music loops perfectly, seamlessly. However, when playing the music in the game itself, you can hear an annoying click in some of the tracks just when the loop starts. This happens with both tracks with and without intros that only play once.

I tried to use Audacity's metadata (loopstart and looplength) to check if it removes the noise in the game but it doesn't work! Why do they sound perfectly fine in Audacity and in the Sound Test but not in game? How can I solve this problem?
I am using loopable BGM for my game and I've noticed that in both Audacity and the RPG Maker Sound Test the music loops perfectly, seamlessly. However, when playing the music in the game itself, you can hear an annoying click in some of the tracks just when the loop starts. This happens with both tracks with and without intros that only play once.

I tried to use Audacity's metadata (loopstart and looplength) to check if it removes the noise in the game but it doesn't work! Why do they sound perfectly fine in Audacity and in the Sound Test but not in game? How can I solve this problem?
Hm....is it a particularly LONG music track? I've done that before, and RPG Maker has a hard time playing it back. In fact there's a long delay before it plays it.
Is there any sort of “tail” on the track? Any sort of audio that goes past the LOOPLENGTH set in the metadata? I always end up chopping anything past the ending sample because I’ve noticed some oddities if I don’t despite setting the samples correctly in the metadata.
most likely the track isn't quite hitting the same note on tempo when it loops.
go to audacity, mark the length of the loop, and see if the beginning and end land on the same level of sample, preferably a zero cross.
if it goes from peak to valley, offset the mark a few samples so it goes from peak to peak or valley to valley.
jumping from one to the other makes that click.
A click or hiss usually means a note is being cut in half. So it probably loops seamlessly but the loop happens in the middle of a note. May need to recut the track?
A click or his usually means a note is being cut in half. So it probably loops seamlessly but the loop happens in the middle of a note. May need to recut the track?
I use Goldwave for all of my sound edits. I haven't had any problems with playback
making weird sounds in it. Maybe you should get it. It even has a bleeper so if someone
swears in an audio file, you can censor it LOL. You can also slow tracks down and play them
backwards.
Hm....is it a particularly LONG music track? I've done that before, and RPG Maker has a hard time playing it back. In fact there's a long delay before it plays it.
It happens with tracks of different lengths, long and short ones. It seems very random because some of the tracks aren't affected by this issue.
Is there any sort of “tail” on the track? Any sort of audio that goes past the LOOPLENGTH set in the metadata? I always end up chopping anything past the ending sample because I’ve noticed some oddities if I don’t despite setting the samples correctly in the metadata.
No, there's nothing after the set LOOPLENGTH. I do the same as you, I cut the leftover music and still hear the click, but only in game...
After you put the metadata, were you exporting the music from Audacity?
Anyway, without actually knowing the music file itself, I can't be sure.
most likely the track isn't quite hitting the same note on tempo when it loops.
go to audacity, mark the length of the loop, and see if the beginning and end land on the same level of sample, preferably a zero cross.
if it goes from peak to valley, offset the mark a few samples so it goes from peak to peak or valley to valley.
jumping from one to the other makes that click.
Do you mean those blue sound waves, right? I already do that, I always make sure that the wave at the end of the loop has the same height that the one at the begining of the same loop, so it doesn't look like it's cut wrong. And yet, you can still hear a subtle cut or click when the music plays in game...
A click or hiss usually means a note is being cut in half. So it probably loops seamlessly but the loop happens in the middle of a note. May need to recut the track?
I tried to recut those tracks but the problem is that the loop sounds absolutely perfect on both Audacity and the sound test, so I don't know what can I fix if everything looks fine... This issue only happens during gameplay.
After you put the metadata, were you exporting the music from Audacity?
Anyway, without actually knowing the music file itself, I can't be sure.
Yes, I always export from Audacity when using metadata. However, most of my music has no metadata at all, and fortunately many of those tracks have no issues.
What happens if instead of exporting, you add the metadata by adding it through editing from the media player? I'm using Foobar2000 for this. In Foobar2000, if you right-click > properties, it will bring this up
1687312302748.png

From here, you can add loop values manually. You still need Audacity to get the correct value though. Just no need to export.
the wave at the end of the loop has the same height that the one at the begining of the same loop
aim for the space in between notes.... zero to zero.
when looping beats at different phrases of the piece, there could be a mismatch of instruments playing at that beat, so aiming for the zero cross reduces the chance of catching a wave of a different note.
if it still clicks after fixing it, it could be a buffering problem if it's a long track.
So I saw this thread when it was first posted and chose not to respond because diagnosing the issue can be tough and not enough information has been provided.
A click in the audio track can be from any number of reasons; from poor loops (which, just because the "blue waves" match - called waveforms by the way - doesn't mean it's perfectly looped, since audio is typically 44,100 samples in a single second, being off by a few millisends with the loop is skipping a substantial number of samples (which you can consider to be like the frames in a game - and when a game even skips 1 frame things feel a little bit jarring right?)
Sometimes things just don't loop well and so you may have to adjust the audio waveform for it to be more appropriate for looping. Deep bassy elements don't loop well and droning pads don't loop well. From my experience bass tends to cause the most noticeable clicks.
You say that it loops fine in the sound tester but not within the game, so this could be a technical reason; perhaps you have limited ram and perhaps the uncompressed sound files are too large when you game is attempting to decode the audio. Perhaps the clicking is caused by your sound devices audio buffer. Perhaps you have some sort of interaction or plugin with your game that interferes with how the game decodes the audio.

In order for us to better diagnose the problem, please provide recordings of your game & editor, including audio samples from the play test and audio test. Please make sure the recordings last more than the length of a single loop. Please share the original sound file being used in the game as well.
aim for the space in between notes.... zero to zero.
when looping beats at different phrases of the piece, there could be a mismatch of instruments playing at that beat, so aiming for the zero cross reduces the chance of catching a wave of a different note.
if it still clicks after fixing it, it could be a buffering problem if it's a long track.

I think this could be it. As I said before, when a note breaks unexpectedly, the human ear hears a pop or hiss. It may be the tiniest pause, but the break in the wave could make this sound. A looping track should pretty much always diminish to quiet where the cut is.
I used to TA a class on human perception and this is one thing I learned about.
@pawsplay I learned about it by splicing tape mixes on a recorder and realizing that I'd need something digital, for which I picked up Cool Edit Pro, which later became Adobe Audition.
that should give you the time frame, the tech level, and my age 😉
Guys, seriously; getting Goldwave solves all of these problems. I
have it myself and use it all the time, and I never have trouble with
this kind of thing; it plays stuff back in RPG Maker gameplay
PERFECTLY.

(Sorry if I sounded a bit intense there.)
I agree with @TheAM-Dol and I can think of a bunch of other audio elements that are difficult to loop perfectly (stuff that pans around, stuff with a lot of reverb and/or a long release). A lot of what I play back in Reaper loops perfect but when you actually try to loop it with metadata for realsies it goes all the Heck.

It could be elements in the track itself, it could be how the loop was performed, it could be something about the settings in the software.

I feel like without more concrete example of what we're working with that we're kinda just tossing darts and seeing what sticks.
Guys, seriously;
The point is, it's not about which software you're using. There are lots of programs you could use to produce good or bad results.

It's about knowing what you're doing in the software and doing it the correct way.

It's also about knowing exactly what the problem is without relying on someone else's textual description of sound.
The point is, it's not about which software you're using. There are lots of programs you could use to produce good or bad results.

It's about knowing what you're doing in the software and doing it the correct way.

It's also about knowing exactly what the problem is without relying on someone else's textual description of sound.
Ok. I wasn't trying to be a know-it-all or anything; just saying that Goldwave is a lot easier to
use, but I guess you could mess up an audio or music track in that one if you don't know what
you're doing, either. I was just trying to save this guy some time. Anyway, if I annoyed anybody
I'm sorry LOL. To be honest I had to figure out how to paste stuff into Goldwave in order to
loop it just like any sound editor.
Without knowing the true nature of the click, there's no saying if a particular software has developed a feature that is better suited to resolving it though. Audacity is free and well-supported so it's easy to recommend.

I've never had an issue with setting the metadata at the correct points in Audacity itself. Nearly every time I've gotten a click it's due to a physical attribute of the instrument or the envelope I'm using on it, but since I make my tracks I can just move the loop point somewhere that doesn't make a click.

If the click comes from something like that, OP's problem might be a bit more complex.
aim for the space in between notes.... zero to zero.
when looping beats at different phrases of the piece, there could be a mismatch of instruments playing at that beat, so aiming for the zero cross reduces the chance of catching a wave of a different note.
if it still clicks after fixing it, it could be a buffering problem if it's a long track.
Most of my tracks are less than two minutes long.
I think I've cut loops as much as in peaks, valleys and those zero crosses. But from now on I will set the end of the loops to a zero cross. Thank you!
So I saw this thread when it was first posted and chose not to respond because diagnosing the issue can be tough and not enough information has been provided.
A click in the audio track can be from any number of reasons; from poor loops (which, just because the "blue waves" match - called waveforms by the way - doesn't mean it's perfectly looped, since audio is typically 44,100 samples in a single second, being off by a few millisends with the loop is skipping a substantial number of samples (which you can consider to be like the frames in a game - and when a game even skips 1 frame things feel a little bit jarring right?)
Sometimes things just don't loop well and so you may have to adjust the audio waveform for it to be more appropriate for looping. Deep bassy elements don't loop well and droning pads don't loop well. From my experience bass tends to cause the most noticeable clicks.
You say that it loops fine in the sound tester but not within the game, so this could be a technical reason; perhaps you have limited ram and perhaps the uncompressed sound files are too large when you game is attempting to decode the audio. Perhaps the clicking is caused by your sound devices audio buffer. Perhaps you have some sort of interaction or plugin with your game that interferes with how the game decodes the audio.

In order for us to better diagnose the problem, please provide recordings of your game & editor, including audio samples from the play test and audio test. Please make sure the recordings last more than the length of a single loop. Please share the original sound file being used in the game as well.
I think there's a chance that the reason for those clicks is because the loop is not perfectly cut, even though it sounds perfect in Audacity. This seems very challenging for me because it requires a lot of precision and I don't know where exactly set the end of the loop, but I will try anyway until it sounds perfect in the game.

The tracks usually last between 30 seconds and a minute and a half so they are generally short. And I don't think I have a problem with RAM or plugins. I only have one music related plugin and it doesn't seem to be causing the snap sound. And I prefer not to share my music for the moment... First I want to try to solve this problem myself.

Thank you for stating possible reasons of why this could happen. I will take all of them into account!

Original thread: https://forums.rpgmakerweb.com/threads/music-makes-a-clicking-noise-when-it-starts-looping.158468/