Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[VX] How to Make Looping Oggs

How to Make Looping Oggs

Introduction

The Ogg Vorbis sound format is a perfect format for BGMs in VX.  Why?  Unlike XP, VX supports the streamed playback of Ogg files as well as looping Oggs.  What does this mean?  It means you can start playing a large song and loop back to a specific point in the song, much like the MIDI event b06f.  So why would you want to go through the trouble of making Oggs loop?  Simple: A much smaller project size, great quality, and your songs can loop.
This tutorial is on how to edit your Ogg files to be loop-able in VX.

What You Need

For this tutorial, I will be using four programs: Calculator, Notepad, Audacity, and WinVorbis.  Calculator and Notepad are standard applications, so you just need to download Audacity and WinVorbis.
Calculator will be used for calculating the values for the looping comments.
Notepad will be used to store the calculated values for when they're needed.
Audacity will be used for finding the exact section of the song that will loop.  You may download Audacity here:  http://audacity.sourceforge.net/
WinVorbis will be used to add the looping comments to the Ogg.  You may download WinVorbis here:  http://www.stationplaylist.com/winvorbis/

Step 1: Importing Your Ogg

Right click the Ogg file you want to loop and open it with Audacity.  If Audacity is not in the open with list, select "Choose Program" and find it.
1.png

Once Audacity has imported your ogg, feel free to remove any white noise or blank at the beginning.  Just select the section you want to delete and press the "Delete" key.

Step 2: Finding Your Loop

This is quite possibly the most tedious step.  First, you'll want to get a general idea of where your loop is.  Once you have the idea, try to select the portion of the song that you want to loop.
2.png

Don't worry about being exact right here.  A later phase of this step if to get it correct.

Now check to see how close your loop is.  Hold down SHIFT and press the PLAY button.  If the loop sounds near perfect, great! Else, you're going to have to try resizing the selection to make it closer.  Remember: You need to hit STOP before changing your selection!

Now it is time to get your loop to be exact! Zoom into the LEFT side of your loop and move the selection to something that can be easily matched.  It should be very close to your original selection.
3.png


Next, do the same to the right hand side, making sure that if the left side was next to it, they'd meet up.
4.png


Keep on adjusting the size of your selection until the loop is seamless.  Just remember to hit STOP before changing the selection.

Step 3: Calculating Your Values

Now that you have your loop perfectly looping, it's time to figure out the values to be used by the looping comments.

The first, and possibly the most important value is the "Sample Rate".  This tells the Ogg how many "samples" there are per second.  The Sample Rate can be figured out just by looking the the lower-left hand corner of Audacity.
5.png

Record down this value in Notepad if you have trouble remembering it.

The second value is when your loop starts.  The thing to note is that Oggs don't use hours:minutes:seconds like we do.  Instead, they use sample positions.  To find the sample position of the loop's starting point, look once again to the lower-left corner of Audacity.
6.png

Here, you'll find the time the loop starts, the time the loop ends, and how long the loop is.  These are all in minutes:seconds, so we'll need to convert them to sample positions.  How, you ask?  Remember the "Sample Rate" you recorded down in notepad?  Simply multiply the times in seconds by it, and you get your sample positions.  Keep the decimal places of your converted answer.  One wrong digit, and you're loop won't work properly!

Start of Loop: 11.870332 * 44100 = 523481.6412
End of Loop: 46.780623 * 44100 = 2063025.4743
Length of Loop: 34.910291 * 44100 = 1539543.8331

Since we don't need the end of loop value, we can toss it away.  The only two sample positions we need are the start of loop, and the length of loop.  Record these into Notepad.

Step 4: Exporting Your (Smaller) Ogg

Congradulations!  You know what values to use for your looping comments!  Now you need to export your Ogg to be only the size it needs to be.  Why?  Some people have issues with material after the loop which causes the loop to malfunctions.  Also, it reduces your Ogg by 30-50%!

Back in Audacity, make your loop selection cover the beginning of the song.  What good does a looping song do without a beginning?
7.png


Now just go to the File Menu and select "Export Selection As Ogg Vorbis...".  Save it under a different name or folder, just incase you somehow messed up your loop.

Step 5: Adding The Loop

Now it finally comes time to add the looping comments to your Ogg!  Right click the Ogg you edited and open it with WinVorbis.
8.png


Click on the "Other Tags" tab then click on the "Add" button.
9.png


A dialog will pop up with two text fields: "Name" and "Value".  It is here, that we'll add our comments.

The two comments that we will add are: LOOPSTART, and LOOPLENGTH.  Enter the name of one of the comments in the "Name" box, and the corresponding value in the "Value" box.  If you look back to your Notepad notes, you'll see that LOOPSTART should be 523481.6412, and LOOPLENGTH should be 1539543.8331.
10.png
11.png

Once you've entered in both values (One at a time!), hit CTRL+S to save.  Exit WinVorbis.

Step 6: Profit

Congradulations, you now have an Ogg Vorbis file that loops when played in RPG Maker VX!  Please note that Ogg files will not loop if played as an ME, so play them as BGMs!



I hope you have enjoyed this tutorial, and have learned something about looping Oggs!
 
Hmm .. this is nice. I didn't know you can make an OGG loop like that. I used Goldwave (Oh well, different apps) but I was wondering how I could patch up the odd intro on the loop. Thanks for the tutorial! :)
 
Hey, just to clear it up, if I have my quality as 22050 (Saving space) instead of 44100, I multiply by 22050 right? I haven't tried this method yet, but I'd like to make sure first.
 
Eh, this really works. :) Saves alot of time and space too. Thanks!
Is it possible to "add" an ending when possible or so? As in when finished with a battle, the song goes to the end of the loop?
 
Seems nice' a tut. This is something I've done for a while but I use GoldWave. You must make sure that the loop isn't too noticeable and annoying. It can get that way if your ogg song is too short.

So, any idea on how to create an ogg that starts at the beginning which includes and intro, and then looping at the loop section, and play for a certain amount of loops, or time, and then start playing the ending to finish the song? Very useful for game ending or intro mucis that will stop on it's own.

Perhaps you can do this with MiDi files? Also, not sure if anyone knows this but OGG bgm's already lop in VX, and also XP. Unless this tutorial is explaining mostly on how to get a smaller filesize, good quality and making it sound like a good loop.
 
Vorpal 86":5jb3wxu6 said:
Seems nice' a tut. This is something I've done for a while but I use GoldWave. You must make sure that the loop isn't too noticeable and annoying. It can get that way if your ogg song is too short.

a

Vorpal 86":5jb3wxu6 said:
So, any idea on how to create an ogg that starts at the beginning which includes and intro, and then looping at the loop section, and play for a certain amount of loops, or time, and then start playing the ending to finish the song? Very useful for game ending or intro mucis that will stop on it's own.

That is impossible without rewriting RGSS2's Audio module.

Vorpal 86":5jb3wxu6 said:
Perhaps you can do this with MiDi files? Also, not sure if anyone knows this but OGG bgm's already lop in VX, and also XP. Unless this tutorial is explaining mostly on how to get a smaller filesize, good quality and making it sound like a good loop.

Yes, you can have a defined loop point in MIDI files: Event b0f6 value 111.  Also, OGG BGMs do NOT loop by default in VX, and especially not in XP.  XP can't even handle OGGs too well.  Finally, this tutorial is HOW to make a DEFINED loop point in an OGG, not how to make smaller filesizes and etc.  That just happens to be a side-effect of the looping process.  Perhaps a picture will explain loop points better?

SONG: [---------------|-----------------------------------------]
      ^               ^                                         ^
    START         LOOP POINT                                   END
Start playing the song from START.  When END is reached, return to LOOP POINT, repeat.  If there is no LOOP POINT defined, return to START.
 
Yeyinde":377n2jjn said:
That is impossible without rewriting RGSS2's Audio module.

I wouldn't even think of that. :)

Yeyinde":377n2jjn said:
Yes, you can have a defined loop point in MIDI files: Event b0f6 value 111...

Where is event b0f6 value 111 locatd in midi files? I assume you have to alter this in the actual midi file, and not RMxxx? I'm not too familiar with MiDi, but a lot of others probably because most midi files don't sound very good since they sound different on different machines. I like OGG because they are compact and easy to save into for me. Nevertheless, RM XP and VX composers have done well to make the rtp musc sound pretty good.

Yeyinde":377n2jjn said:
Also, OGG BGMs do NOT loop by default in VX, and especially not in XP...

I tested an OGG in VX as a BGM before I posted, and it looped pretty well to me. You must be talking about how they were not DESIGNED (composed..) to loop? Unless telling vx/xp to loop them, they won't, I agree. Considering the only OGG's that come default with XP and VX were sound effects and bg sounds, and no BGM's,they won't loop by default, no. This is also the case with XP. My ogg file looped fine in it as well.

If you were to load in one of the OGG bg sounds as a BGM, then, they would loop. As you said, BGM's will loop, even by default, but they need to be set in the BGM folder. You don't even have to set the OGG Tag. I didn't in my OGG file and it looped fine.

This is good info, no? :)
 
Okay, can you please repost all the pics for this tutorial?
Im totaly lost without the pics to help explain..
Also, can i repost this tutorial on another forum?
 
sorry to say this on SUCH a dead topic but this didn't work out for me T_T. Followed directions to the letter. Probably just cuz I'm dumb when it comes to actually editing files ^^;
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top