vgm_trim
vgm_trim is a tool for trimming and looping VGM files.
Usage
You may drag and drop a file onto the program to be prompted for inputs, or use the command line as shown below.
vgm_trim YourFileGoesHere.vgm startSample loopSample endSample OptionalCustomOutputName.vgm
Example:
vgm_trim track1.vgm 15280 23499 194222
The inputs startSample, loopSample and endSample are expressed in 44100Hz samples.
| Input | Description | Default | Special Values |
|---|---|---|---|
| Start Sample | The 1st sample of the new VGM file | 0 | |
| Loop Sample | Sample to which the VGM goes when it loops back | 0 |
|
| End Sample | Sample where the VGM ends or loops back | 0 |
|
Any data in the VGM after End Sample is not included, unless End Sample is one of the special values above.
Suggestions
These require using the command line form.
- To automatically create a record of your sample points, add
>> trim_points.txtto the end of your vgm_trim commands. This should create a text file of that name if it doesn't exist, and add vgm_trim's output to the end of that file. - (Discouraged) If you put the argument `-state` after the program name, 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.
Finding Input Samples
There are several methods.
- Usually, you can use
vgmlpfndto get a reasonable loopSample and endSample, and get a good startSample withvgm2txt. - (Suggested by MaliceX) If
vgmlpfndfails to find good samples, you can listen to the track to find the approximate sample times. Then, use vgm2txt to look in those areas for the sample values to use. (See Finding Trim Points with vgm2txt, ideally after it has been revised for readability.) - Sometimes it is useful to use a 44100Hz WAV recording of your VGM, and find the approximate sample points with an audio editing software such as Tenacity, Wavosaur, Sony Sound Forge, or others. You can then cross-check the sample values with
vgm2txtto be sure. (See Finding Trim Points in WAV Files, ideally after it has been revised for readability.)
Advanced users: If you're familiar with assembly, the intuition of using vgm2txt to find 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.