Skip to content

OPL2 /ym3812 dro/vgm are huge

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

Moderator: Staff

  • Mills Offline
  • Posts: 12
  • Joined: 2015-06-05, 23:08:44

OPL2 /ym3812 dro/vgm are huge

Post by Mills »

I'm ripping some opl2 music with dosbox, using the dro exporter and also de vgm exporter, and the rips are huge, the vgms exported from dosbox are even bigger.

Can we do anything to optimize the rips?

Other opl2 rips are compressed in vgz, but is that the only way?

Thanks.
  • User avatar
  • ValleyBell Offline
  • Posts: 4768
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

After you finished trimming, you can run vgm_cmp on the resulting files. Depending on how the sound engine works, that might make them smaller.

Depending on the song and sound engine though, even OPL2 songs can get pretty large. About 100 KB and more would be quite normal for a song that uses lots of software vibrato and other effects.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

I saw that you wanted to play VGM files on an arduino, and that is likely why you made this thread (It has only 32K of flash, that needs to hold the program code and data)

Unfortunately, most VGMs will not fit within that 32k. Maybe short or simple songs that use no channel allocation and no software envelopes might fit. But if you want to play most VGMs, you should consider streaming the files via USB instead. Currently there is no player that supports this, so you might need to make one yourself. I have considered doing this actually for the YM2151, as a bonus one could have the PC handle the PCM part and then just mix that with the FM chip output.

You can also use an SD card if you have a shield or other board that has an SD card slot. There is a built in library in the arduino IDE for reading and writing SD cards. Since files are read as streams, file size shouldn't be an issue. It's important that the FM shield does not conflict with the pins used for SPI in that case.

Another way (that does not require USB or an SD card) is If you used the original sequenced data and reimplemented the game's sound driver (or player routine), then it is more likely that you might be able to fit everything in 32k. Of course depending on what the original format the songs were in.

Btw, >32kb doesn't exactly make a VGM huge. I'd consider a few MBs to be "huge" in that case. And another way to play VGMs on real hardware that works even with little memory is to simply use an old PC. There are DOS-based players and the VGMPlay builds that you can download work with win9x thanks to VC6.
  • Mills Offline
  • Posts: 12
  • Joined: 2015-06-05, 23:08:44

Post by Mills »

ctr wrote:I saw that you wanted to play VGM files on an arduino, and that is likely why you made this thread (It has only 32K of flash, that needs to hold the program code and data)
Yes I'm going to play vgms on an arduino with a real opl2 :). And I knew i'll need an sd card reader, that's not a problem.

I was ripping the vgms from "fuzzy's world of... etc etc" they are about 300 Kb!, vgm_cmp did nothing to them :(. That game uses an adlib tracker called loudness, and it surelly pushes de opl2 limits, so I guess the vgm has to store a lot of parameters and instrumets.

The original files in the lds format are about 5 kb, but the format is very unknown and not playable for most people, only the adplug plugin can play them and it looks like it's not very popular.

I just realized, I might shrink the files to half the size if i work a bit looking for the loops and everything, so the optimized files should be around 150 kb I hope.

EDIT: I think I won't be able to optimize the vgms from this game, most of them have no repeating patterns, but very long songs and always changing some instrument or some drums. And the ones that have a loop, it is in the middle of the song, like: intro - loop - ending, and I think I can't trim the vgm with this kind of loop using vgm_trim.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

the adplug plugin is open source, isn't it? That means the format is probably documented as well and writing a replayer for the arduino shouldn't be too difficult then.

edit: yup, source is here.
  • Mills Offline
  • Posts: 12
  • Joined: 2015-06-05, 23:08:44

Post by Mills »

ctr wrote:the adplug plugin is open source, isn't it? That means the format is probably documented as well and writing a replayer for the arduino shouldn't be too difficult then.

edit: yup, source is here.
Yes I think it is being ported, but anyway I'll make the vgm pack for this game :).
  • User avatar
  • grauw Offline
  • Posts: 150
  • Joined: 2015-02-22, 3:40:22

Post by grauw »

Heh, vgm_cmp did nothing? Surprising, for me nearly always it shaves off a fair chunk. Guess the sound driver doesn’t talk to the chip unless it needs to, or the recording already removed duplicate writes. Indeed 300 kB for a long song isn’t all that surprising, and if the composition does complex stuff with its channel instrumentation or software envelopes or something, it can add up quickly. For the record, how big is the file when gzipped?
  • Mills Offline
  • Posts: 12
  • Joined: 2015-06-05, 23:08:44

Post by Mills »

grauw wrote:Heh, vgm_cmp did nothing? Surprising, for me nearly always it shaves off a fair chunk. Guess the sound driver doesn’t talk to the chip unless it needs to, or the recording already removed duplicate writes. Indeed 300 kB for a long song isn’t all that surprising, and if the composition does complex stuff with its channel instrumentation or software envelopes or something, it can add up quickly. For the record, how big is the file when gzipped?
Not bad in vgz, I finished the pack :D .
Post Reply