Vgm trim
vgm_trim is a tool for trimming and looping VGM files. You may drag and drop a file onto the program to be prompted for inputs, or use the command line as shown below.
Usage:
vgm_trim <file.vgm> startSample loopSample endSample [output.vgm]
Example:
vgm_trim track1.vgm 15280 23499 194222
- Start Sample: the 1st sample of the new VGM file (default: 0)
- Loop Sample: sample to which the VGM loops back (default: 0). Special Values:
- 0 - Looping off
- -1 - Loop from Start Sample (you must use this if Start Sample is 0)
- -2 - Keep old Loop Point (if there was no loop there will be no loop)
- End Sample: sample where the VGM ends or loops back (default: 0, data of this sample is deleted if EndSample < TotalSamples). Special Values:
- 0 - actually not a special value, but can be used to cancel trimming
- -1 - use Total Samples-Value
The parameters startSample
, loopSample
and endSample
are expressed in 44100Hz samples.
You can have different approaches to the workflow of finding good sample points.
- Usually, you can use
vgmlpfnd
to obtain a reasonable loopsample and endsample before getting a good startsample withvgm2txt
. - 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.
If you insert the argument `-state` after the program name on the command line, then vgm_trim will put a save state of all used chips at the beginning of the VGM. You can use this if the instruments don't want to sound right even with silence at the beginning. However, it isn't recommended and is not yet supported for all chips.