Skip to content

Decent tutorial on trimming VGM files

Technical discussion about the VGM format, and all the software you need to handle VGM files.

Moderator: Staff

Decent tutorial on trimming VGM files

Post by HappySpaceInvader »

Can anyone please point me at an in-depth tutorial on how to use vgm2txt and vgmlpfind to get the right values for vgm_trim?

I do have some previous minor experience with vgm2txt, vim_trim, etc. but this was for "single shot" music tracks that don't loop (Fantasia on Genesis), so it was extremely easy to find the start and end points in the vgm2txt file.

I'm now trying to rip the music from "PGA Tour Golf" on Genesis, which are regular tracks that loop (although I don't think any have an intro section, which makes things easier).

I logged the main theme (when the game starts) over 3 repeats but I can't work out how to find the start and end points in the vgm2txt file (attached), and vgmlpfind produced the output below... which I don't understand.

If there isn't already an online in-depth guide... then I'd really appreciate help understanding this particular output.

Code: Select all

C:\Users\richa\Documents\Mega Drive Music Ripping\PGA Tour Golf>..\VGMTools\vgmlpfnd.exe "Main Theme.vgm"
VGM Loop Finder
---------------

File Name:      Main Theme.vgm
Step Size (default: 1):
Minimum Number of matching Commands (default: 1024):
Start Pos (default: 0 - auto):

Counting Commands ...  242831
Reading Commands ...  Done.
  Source Block            Block Copy            Copy Information
Start     Time          Start     Time          Cmds    Time
1737609 00:39.40 242831 2108528 00:47.81        1927    00:07.74
3232336 01:13.30  !428318054262 03:02.64        170960  06:10.21
5075143%01:55.08 / 242835446054 02:03.49        2127    00:05.24
5075143 01:55.08        10267986        03:52.83        2127    00:05.24
5075143 01:55.08        15089913        05:42.17        2127    00:05.24
5075143 01:55.08        19911841        07:31.52        2127    00:05.24
5446054%02:03.49 / 242839897070 03:44.42        2127    00:05.24
5446054 02:03.49        14718996        05:33.76        2127    00:05.24
5446054 02:03.49        19540928        07:23.10        2127    00:05.24
5952396%02:14.97 / 242836323315 02:23.39        1675    00:03.52
5952396 02:14.97        11145238        04:12.73        1675    00:03.52
5952396 02:14.97        15967168        06:02.07        1675    00:03.52
5952396 02:14.97        20789098        07:51.41        1675    00:03.52
6323315%02:23.39 / 2428310774319        04:04.32        1675    00:03.52
6323315 02:23.39        15596255        05:53.66        1675    00:03.52
6323315 02:23.39        20418182        07:43.00        1675    00:03.52
6559551%02:28.74 / 242836930467 02:37.15        3719    00:07.74
6559551 02:28.74        11752397        04:26.49        3719    00:07.74
6559551 02:28.74        16574322        06:15.83        3719    00:07.74
6559551 02:28.74        21396251        08:05.18        3719    00:07.74
6930467%02:37.15 / 2428311381479        04:18.08        3719    00:07.74
6930467 02:37.15        16203405        06:07.42        3719    00:07.74
6930467 02:37.15        21025336        07:56.76        3719    00:07.74
Done.1 % - 235596 / 242831
Attachments
Main Theme.txt
PGA Tour Gold main theme from vgm2txt.
(36.5 MiB) Downloaded 64 times

Post by Mao (RN22) »

im not good at explaining but based on my experience, vgmlpfnd's purpose is to find loop points and end points of an vgm file. i use this to trim my vgm files without to do manual looping, but sometimes vgmlpfnd can be useless at all. to find a proper loop, you must need to log musics and play it at least 3 to 4 loops which vgmlpfnd can find the exact commands and determine what sample values has the proper loop.

Example for this:

Code: Select all

 Source Block		  Block Copy		Copy Information
 Start	  Time		Start	  Time		Cmds	Time
 477258	00:10.82	2374215	00:53.84	26535	00:34.59
 Done.   
The values you need are Start from the Source Block and Start from the Block Copy. The first value (Source / Block) means "where the loop starts" and the second one (Block / Copy) "where the end sample starts", so actually where the original loop ended. You can use then use vgm_trim with the inputs 0, 477258 and 2374215 in this case.

vgmlpfnd may report f, ! and e in the results. "f" means a proper loop has been found, which is more probable to be the right one than others without an "f" or !. If a "!" is displayed, it means it's almost sure the the correct loop has been found.

Code: Select all

 Source Block		  Block Copy		Copy Information
 Start	  Time		Start	  Time		Cmds	Time
 477258	00:10.82	  f    2374215	00:53.84	      26535	00:34.59
 Done.   

When you don't get an "f" or a "!", don't worry about it; just check the actual loop time of the track and compare that with the results. Or try to relog it again with much more loops, around 5 to 7 loops if see if vgmlpfnd is gonna find the proper loop for that. If it doesn't work again, try to lower the "minimum of matching commands" to like odd or even numbers. Default of this command is 1024, so try lower, maybe 512 or like 128. after that, there's a bunch of loop points that you can find, it's a little bit tricky, but one thing that you've need to find in vgmlpfnd is the marking like "f" or "!", which proper loop has been found. if it does not working again, I'm sorry, but you have to do manual looping using audacity.


vgm2txt is somewhat edit your vgm files using hex edit, finding the same loop points of each offsets to compare and verify it. or to remove volume of an sample. but there's much more for that that i can't explain properly. But there's an accurate description I found on SMSPower.

VGM Text Writer (vgm2txt) This program converts a vgm to a txt file showing the list of commands in byte order. Although it does not encode the values to notes, it does provide helpful labels, and helps you verify loop points and proper sample values to enter in vgm_trim. If the loop finder has challenges, this tool will help you see why. It acts as a second set of eyes on the results of the loop finder. Although loopfinder is easier to use, the output, once understood, will be the superior authority on the proper loop point. It shows you exactly what is going on. This is also an important asset in the vgm processing toolkit.
-SMSPower

So, that's it. Hope it helps.
To-Do list:
?

Current Status: I could only upload 5 VGM packs per VB's stream.
Tempo: 105.95%
Pitch: +1.00

Better Call Mao!

Image

Please, check my WIP list for more updates.

Post by Mao (RN22) »

I've almost forgot!

You can use vgm_sptd to cut silence or delay at the start of the music. remember, not all vgm files were cutted properly so if the vgm doesnt cut properly on the start sample points, you have to do manually as i said.
To-Do list:
?

Current Status: I could only upload 5 VGM packs per VB's stream.
Tempo: 105.95%
Pitch: +1.00

Better Call Mao!

Image

Please, check my WIP list for more updates.

Post by HappySpaceInvader »

Thanks - that's all extremely helpful. I guess a large part of this is also just trying out the values in vgm_trim and listening back to the result.

What particularly confused me about the vgmlpfind output were lines like this:

Code: Select all

5446054%02:03.49 / 242839897070 03:44.42        2127    00:05.24


where the values seem too large for the columns. What's going on there?

Post by Mao (RN22) »

Oh, we're the same as mine too. Right now, I'm using Ubuntu for VGM ripping, cuz my hard drive broke. Don't worry about that output. What I'm usually do when I encounter this is to match the loop value number and end value number counts.

example of this

Code: Select all

5446054%02:03.49 / 242839897070 03:44.42        2127    00:05.24
so the loop value is 5446054 which is counted 7 digit numbers. after that, you have to match it on the end sample value. Start at the last digit of the number like this, 9897070. also if you encounter this thing, you need to look up another loop points as a reference, and also the time. which is important how the samples increased by 1 digit or not.

example of this

Code: Select all

5446054 02:03.49        14718996        05:33.76        2127    00:05.24
5446054 02:03.49        19540928        07:23.10        2127    00:05.24
6323315%02:23.39 / 2428310774319        04:04.32        1675    00:03.52
6323315 02:23.39        15596255        05:53.66        1675    00:03.52
6323315 02:23.39        20418182        07:43.00        1675    00:03.52
on the third line, you see a bunch of joined numbers that you have struggled with. now, I want you to look at the another line, like line 1 or line 5. use that to match the sample value between what digit numbers count.


sorry if i cant explain it to you properly, but it is what it is.
To-Do list:
?

Current Status: I could only upload 5 VGM packs per VB's stream.
Tempo: 105.95%
Pitch: +1.00

Better Call Mao!

Image

Please, check my WIP list for more updates.
  • User avatar
  • ValleyBell Offline
  • Posts: 4767
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

The broken columns are probably caused by me using "tabs" for indentation.
On Windows, printing a "tab" character erases all characters that are skipped. On Linux systems, it often doesn't erase stuff.
I guess that is something I need to fix in vgmlpfnd.

And HappySpaceInvader:
Please don't attach "vgm2txt" output. Just attach the raw VGM itself.
The .txt file is useless if we want to help and we can easily generate it by ourselves.
Post Reply