Manual looping tutorial

From vgmrips

This is probably the fastest method to loop songs manually using vgm_trim and audacity. When you have familiarized yourself with this method, you will be able to trim most songs manually in just a few minutes.

Preparations

Before starting, you will need:

  • vgm_trim and zlib1.dll in your VGM directory.
  • Corresponding WAV files for your VGMs, at a sample rate of 44100.
  • Audacity or equivalent wave editor. I suggest you use Audacity since it's what I'm using for this tutorial.

To save some time, I also recommend you verify that you are not getting anything useful from vgmlpfnd. Manually looping VGMs can still take time depending on the song and the sound driver used to play it.

Tutorial

First, open your WAV file in Audacity. Also, if you haven't already, open a notepad window and a command line window navigated to your VGM directory.

Now take a look at the bottom of your audacity window. First, make sure the project rate is 44100 and that the time offsets are in samples.

When you're done, it should look like the screenshot below:

Location of the Time Shift tool

Now you will want to duplicate the audio track. Just select it and press Ctrl+D. Once that is done, use the Time Shift Tool to drag the second track right until the first loop aligns with the second loop in the first track. You can adjust the panning of the tracks and play them to check if the loop sounds good or not.

When you're done, it should look like the screenshot below: (Notice the panning on the tracks)

Now you will find the actual loop points. Zoom in to the section where the loop begins on the second track and look for when the waveforms of the first and second tracks match. Using the panning trick should help here.

Go back to the Selection Tool and select a point where the two tracks match. It doesn't have to be right on the spot, I suggest letting a note play for a little while. Also, since we're trimming VGMs, you don't have to be too precise. Just make sure it sounds good.

To identify the trim points we will use Audacity's label feature. Create labels by pressing Ctrl+B. Drag the label track that appears to below the first track, select the bar on the second track and press Ctrl+B again. You should now have created two label tracks on the same spot. It should look like the screenshot below:

Location of the Sync-Lock Tracks button

We have now found the end position of the loop. To find the start position, enable Sync-Lock Tracks and drag the second track back to the starting point. The label track should follow. When you're done, it should look like the screenshot below.

We have now found the start and end positions of the loop. You can now open your notepad window and note down the start and end positions of the loop. To find the sample numbers, in Audacity just click on a label and look at the sample position on the bottom of the window. In the case your VGM begins with a lot of silence, you might also want to write down the start position of the song itself.

Now, open your command-line window and run vgm_trim from the command line. To save some time, you can run it like a regular command line tool using program arguments like shown below.

 vgm_trim <filename> <song start> <loop start> <loop end>

A note: if your filename includes spaces, enclose it in quote marks. So for my VGM, we would run vgm_trim with the following arguments:

 vgm_trim 02.vgm 0 491336 1776841

After running vgm_trim, it will write a new file called something like "02_trimmed.vgm". Play it in your favourite VGM player and listen very carefully around the loop point.

A common problem is that some channels do not silence completely or play with the wrong instrument. If this happens, you don't have to go back to Audacity just yet. We might be able to fix this just by doing small adjustments to the loop and end point. At the command line window, press the up arrow key to restore the previous command and just add something like 10000 to the loop start and end arguments, like shown below:

 vgm_trim 02.vgm 0 501336 1786841

Repeat this until you get a loop point that sounds good. If the adjustments do not work, try a larger number, and if this still does not work, go back to Audacity, and find a new loop point by dragging the second track with the time-shift tool. Also remember to note down all the successful trim points, just in case...

Notes

Some chips can be picky with the loop position, especially PCM chips with many channels like the Namco C352.

Games using dynamic channel allocation (like most games using the MultiPCM) are probably the absolute worst to trim. You need very precise timing and probably some assistance from vgm2txt combined with knowledge of the chip to make sure the loop sounds good.

Before starting a new song, you might want to make sure the sync-lock tracks mode is turned off.