Audio Looping using Metadata tags.

Ever wonder how the default RPG maker music loops? It's pretty simple, but in spite of looking I have never seen anyone explain it on the forums. RMMV (And AFAIK most other makers) are designed to read STARTLOOP and LOOPLENGTH tags in an audio files metadata. I'll be using a small piece of open source software I found on source forge called kid3 to edit the metadata and read the audio sample rate.

*Note; some audio filetypes use metadata tags differently. This tutorial may not work for every filetype - but it should work with OGG and M4A files at the very least.

Step 0 - Browse to your file in your metadata editor.
Step 1 - Note your Sample Rate (Hz).
Step 2 - Create a new Metadata Tag
Step 3 - It's important to name the frame ID "LOOPSTART" no quotations. As for the next window "text"; we will have to do some math - find the point in the song that should be the beginning of your loop. You want the exact time to make the loop seamless. Convert that time to seconds. Multiply the number of second by your sample rate (I recommend using a calculator) 😉. The resulting number will be the value of the tag; aka, what you put in the "text" field.

In the example below - My sample rate is 44100 hz, and my loop starts at exactly 56 seconds. as a result - the LOOPSTART value was 2469600.

upload_2017-2-10_3-54-19.png


Step 4 - You now need to determine how long your loop will go for before starting again. Convert it to seconds, then multiply it by the sample rate. Create another tag, and call it "LOOPLENGTH", the input field should contain the result of the math done earlier in this step.

In the above example I wanted to loop the the rest of the song. The song is 2:20, so I took those 140 seconds, and deducted the 56 seconds before the loop started, leaving me with 84 seconds. 84 x my sample rate (44100) = 3704400.

Done. Don't forget to save, then throw it into RMMV as a BGM, and provided you got the times right - your music will loop seamlessly.
This was really useful to me so thanks for making this thread. I was wondering if there was a way to test if the loop worked without having to use rpg maker and also, is this metadata used in games that are not created with rpg maker?
@Ryethegret This is the official site for RPG Maker and we do not give support to engines not published by Degica. It would be luke going on to a Ford site and asking for help with a car made by General Motors.
Yeah sorry I see that now. I was having trouble putting my music into the RPG maker so I thought maybe another programme would because kid3 wouldn't give me a playback of my loop.

Original thread: https://forums.rpgmakerweb.com/threads/audio-looping-using-metadata-tags.74700/