Vgm trim

From vgmrips

vgm_trim is a tool for trimming and looping VGM files.

Usage:

vgm_trim <file.vgm> startSample loopSample endSample

Example:

vgm_trim track1.vgm 15280 23499 194222

The parameters startSample, loopSample and endSample are expressed in 44100Hz samples. Usually, you can use vgmlpfnd to obtain a reasonable loopsample and endsample before getting a good startsample with vgm2txt.

You can have different approaches to the workflow of finding good sample points.

  • One approach (used by MaliceX) where vgmlpfnd fails to find a good loop point, you can fall back to listening for the approximate looping times, then use vgm2txt to trace for the sample values to use for looping. (See Finding Trim Points with vgm2txt.)
  • Sometimes it is useful to use a 44100Hz WAV recording and finding the approximate sample points with an audio editing software, such as Audacity, Wavosaur, Sony Sound Forge among others, then cross-checking the desired sample values with vgm2txt. (See Finding Trim Points in WAV Files.)

If you're familiar with assembly, the intuition of using vgm2txt to finding the best sample point through looking for the relevant command patterns should be similar to finding a good opcode to replace with a JMP in a disassembly.

You can note down your loop points by hand, but to simulate VGMTool's log of loop points, add >> loop_points.txt to the end of your vgm_trim commands. This should create a text file of that name if it doesn't exist, and append vgm_trim's output to the end of that file.