Wohlstand / libOPNMIDI

A Software MIDI Synthesizer library with OPN2 (YM2612) emulator
GNU Lesser General Public License v3.0
91 stars 7 forks source link

Make MIDI2VGM with using of raw YM2612 stream of chip #93

Closed Wohlstand closed 9 months ago

Wohlstand commented 5 years ago

It's would be cool to implement something like MIDI2VGM converter. What to do:

Because of the perfect automatical channels management model, this thing will allow the making of VGM files much easier and the result will be much better than Nineko's experimental thing which requires every MIDI channel to use single note while OPNMIDI does full automation of channel management.

The complete VGM specification is here: https://vgmrips.net/wiki/VGM_Specification

jpcima commented 5 years ago

It's the problem with VGM, I doubt you can use as many devices as you want in it. Technically in s98, you could. The libvgm code supports s98 format. Whether that library implement multi-device, it remains to be checked.

Wohlstand commented 5 years ago

Right now it's need ym2612 only which is simplest thing now

jpcima commented 5 years ago

I actually mean multi-chip above (as in 4x YM2612), not multi-device

Wohlstand commented 5 years ago

Yeah, therefore a single-chip mode only will be,, and yeah, the channel manager can work on single-chip wisely until polyphony overflow that will cause arpeggio.

Wohlstand commented 5 years ago

Okay, I have made the experimental branch with the working thing: https://github.com/Wohlstand/libOPNMIDI/tree/midi2vgm

There are samples I made with this WIP version: custom_vgms.zip

Wohlstand commented 5 years ago

s98 format

Oh, a thing I have missed up... Does it support full multi-chip to have 4~8 chips? Or it has some limits? VGM, as I see, is able to run two chips maximum.

Wohlstand commented 5 years ago

So, http://www.purose.net/befis/download/kmp/old/s98spec2.txt Yeah, I see S98 really can multichip. :eyes:

jpcima commented 5 years ago

Yes, I was trying to tell this. A s98 file has a pair of indexes for devices, with one being to call the lower register bank, and the other for the upper. By usage of this addressing, it covers the full OPL3.

Some chips don't need the upper bank. In libvgm, it says even a chip which uses one only occupy 2 indices; however in OPL-BE, I remember I have considered it took 1...

So, I may have wrong implementation there. Or it's libvgm... Back then, I have based my understanding only on the S98 spec document, and not other's code.

freq-mod commented 5 years ago

I'm testing this tool right now, everything seems to be fine, but I noticed that created VGMs are a bit louder than midis, both played via PGE MUSplay with MAME YM2612 at volume level 100. That's weird.

Also, in the future, would i be possible to add option to log into YM2608 VGM?

Wohlstand commented 5 years ago

Note that in GME is an unfixed bug at its resampler which damages quality a bit, so, please try to play via ZXTune which gives better sound quality. Yeah, that a good idea to also support OPNA and some other chips.

freq-mod commented 5 years ago

GME is an unfixed bug at its resampler which damages quality a bit

Oh, I see. Thanks for recommending me ZXTune, now it sounds way better, not terribly loud anymore 😉

Wohlstand commented 4 years ago

@ValleyBell, maybe you know something better about VGM optimization? I have MIDI2VGM code and here is an actual VGM writer: https://github.com/Wohlstand/libOPNMIDI/blob/master/src/chips/vgm_file_dumper.cpp which does the writing of music data in as-is form, in result, there are music files with a mass at least 1 MB size. Your vgm_cmp helps me a lot to compress it into few kilobytes and gzip helps to make the smaller vgz. I think, it's would be better to generate the optimized output rather than requiring to do extra actions to compress it. (the midi2vgm tool itself is in utils/midi2vgm which toggles the libOPNMIDI library into "make me VGM file please" mode and does a write of VGM file).

https://github.com/vgmrips/vgmtools/blob/master/vgm_cmp.c

Wohlstand commented 4 years ago

@papiezak, with recent updates of MixerX and PGE MusPlay I have been fixed quality of VGM playing, now they are playing clearly. However, it's a testing player and ZXTune is a better player for enjoying the music and having playlists on aboard.

Wohlstand commented 4 years ago

Some days ago I did the VGM-Cmp usage and ZLib output support: https://github.com/Wohlstand/libOPNMIDI/commit/81c60705a75728b4c7ce6b570766b430724f318d So, the tool will generate the compact output.

Wohlstand commented 9 months ago

Closing this thing as it's seems, fully completed a while ago.