Skip to content

VGMPlay / in_vgm

Last update: 2023-12-31 (v0.51.1)

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

Moderator: Staff

  • Dekyo-NO Offline
  • Posts: 100
  • Joined: 2017-11-02, 3:58:27

Post by Dekyo-NO »

I'm having some problems with the foo_input_vgm component.

Sometimes the M3U files that comes with VGM packages do not play at all, sometimes they play correctly.
Is someone having this problem? Or maybe it's because I have many components installed?
  • TheYokai Offline
  • Posts: 5
  • Joined: 2018-06-22, 5:11:41

Post by TheYokai »

Any chance that an adaptation of this (or LibVGM) could be made as a GStreamer plugin?

GStreamer currently uses a (very very old) version of libGME which is not only inaccurate but supports very few consoles and cannot playback any VGZ files. I came across this as an issue when trying to add VGM playback to popular linux media player Clementine ( Clementine pull request #6089 for more details). It would really rock if this library could be made as a gstreamer element!
  • User avatar
  • blitzlunar Offline
  • Posts: 126
  • Joined: 2012-12-21, 15:30:24
  • Location: UK

Post by blitzlunar »

Dekyo-NO wrote:I'm having some problems with the foo_input_vgm component.

Sometimes the M3U files that comes with VGM packages do not play at all, sometimes they play correctly.
Is someone having this problem? Or maybe it's because I have many components installed?
Can you give an example of a set that is raising this problem for you? Usually they work for me, but I don't tend to use the m3us anyway.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

TheYokai wrote:Any chance that an adaptation of this (or LibVGM) could be made as a GStreamer plugin?
There won't be a GStreamer plugin for vgmplay due to some fairly extensive code rewrite that would be required to run it as a gstreamer plugin. (no global variables for example)

Maybe there could be one for libvgm however.
  • Dekyo-NO Offline
  • Posts: 100
  • Joined: 2017-11-02, 3:58:27

Post by Dekyo-NO »

@blitzlunar That happens with all VGM packages.
It happens like this:
The first time I open an m3u file that comes in a VGM package does not play, but the second time I open it (without having closed foobar2000) it plays normally.


Anyway, it's not a serious problem. I can live without the m3u.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

Dekyo-NO wrote:The first time I open an m3u file that comes in a VGM package does not play, but the second time I open it (without having closed foobar2000) it plays normally.
We don't maintain the fb2k plugin, so there's really nothing we can do about it. Try opening the m3u in vgmplay (just drag/drop to the vgmplay exe) or winamp with in_vgm.
  • User avatar
  • ValleyBell Offline
  • Posts: 4745
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

Christmas Release!

You can download the new version of VGMPlay / in_vgm from GitHub. (I'll replace this with links to vgmrips.net when the FTP is working again.)

The most important updates are:
  • accurate QSound emulation (thanks to ctr)
  • slightly improved emulation of YMF278B, YMF271, SAA1099 and C352
  • added Nuked OPN2 sound core (cycle-accurate YM2612 emulation, thanks to Nuke.YKT)
  • in_vgm: fixed some bugs
  • in_vgm: made "Tag fallback" option work
  • in_vgm: fixed display of outdated tag information
I actually wanted support for media keys and DBus on Linux for this release, but it seems like this will take a while.
I didn't plan to release any further updates for this version of VGMPlay, but I'll definitely do a minor update when that is finished.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

It should be noted that NukedOPN2 isn't the default YM2612 core for the following reasons:
  • Certain VGMs from Project2612 do not play properly at the moment, this is usually due to garbage or invalid register writes at the beginning of the VGM.
  • The in_vgm configuration GUI does not support per-core options, this is important for the NukedOPN2 core especially since it has options to set the chip type (YM2612 / discrete YM3438 / ASIC Megadrive 2) which affect ladder effect and low-pass filtering options. This can be enabled by editing the config file though.
  • CPU usage is rather high, which especially affects backwards seeking.
You can enable it by editing the "EmulatorType" variable in VGMPlay.ini or the using the in_vgm config menu. By editing the "NukedType" option (VGMPlay only, unless you edit in_vgm config files directly) you can set the emulated chip type.

On the other hand, the new QSound core is set as default in this release. If you wish to use the old core, you can also do so, however I believe the new core should work with all existing VGMs as a workaround for the old vgm_cmp behavior has been implemented.

If you have any issues with the new cores, please let us know.

Merry Christmas, and hope you enjoy this release.

Post by Infomaniac95 »

Hello, so sorry to drop in like this, but I was pondering as to if you can adjust the lowpass at all on nuked opn2.

Im using the winamp plugin, and would like to set the lowpass to something like 40%.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

Unfortunately, the filter parameter is hardcoded. You can disable the lowpass filter entirely (and also the ladder effect) by editing %appdata%\Winamp\plugins\in_vgm.ini, the option is called "YM2612 NukedType". Remember to close winamp before saving the modified file.
  • kirishima Offline
  • Posts: 82
  • Joined: 2015-06-18, 22:26:41

Post by kirishima »

Foobar input_vgm plugin has been updated to v0.29.

https://ux.getuploader.com/foobar2000/download/213
  • kodi Offline
  • Posts: 2
  • Joined: 2019-02-24, 4:51:57

few questions about YMF278B

Post by kodi »

Q1: How to disable WT output and FM output for YMF278B?

I want to hear, which sounds are FM and which WT, but even when set both "MuteMask_FM" and "MuteMask_WT" in the INI file, the exact same sound as when they are not set is produced and nothing is muted:

* Test VGM file: "Sonyc_MS\01_Title.vgm"

* VGMPlay.ini Settings:

Code: Select all

[YMF278B]
Disabled = False
MuteMask_WT = 0x3f
MuteMask_FM = 0x3f
Q2: How to convert Yamaha YMF278B Demo MIDI files to VGM format?

they are regular MIDI files and both FM and WT of YMF278B are used at the same time to give maximum 44 voices polyphony (20 from FM and 24 from WT) in the following way - first X MIDI channels are reserved for WT and the rest (16 -X) for FM, X is known for each MIDI file and it's set before playback.

Thank you!
  • lo zaffo Offline
  • Posts: 38
  • Joined: 2016-08-03, 22:36:09
  • Location: Italy

Post by lo zaffo »

I really don't want to make just noise in this thread, but today I updated and compiled from source libVgz and tested a bit its player.
I'm very happy with it. :beer:

I only did some libraries compiling : zlib and iconv in order to have them built for 64-bit and a small copycat of vgmtest player audio driver initialization for having player working on my Windows 7 box.

before DirectSound was failing like this
C:\Users\user\workspace\libvgm\buildVS2017\bin\Release>player.exe "C:\Users\user\Music\vgm\Armed Police Batrider(1998-02-13)(Raizing)(Eighting)\01 Raizing Logo.vgm"
Opening Audio Device ...
Using driver DirectSound.
Opening Device 0 ...
Device Init Error: F1

After switch to WinMM
C:\Users\user\workspace\libvgm\buildVS2017\bin\Release>player.exe "C:\Users\user\Music\vgm\Armed Police Batrider (1998-02-13)(Raizing)(Eighting)\01 Raizing Logo.vgm"
Opening Audio Device ...
Using driver WinMM.
Opening Device 0 ...
Loading 01 Raizing Logo.vgm ... VGM v161, Total Length: 1.52 s, Loop Length: 0.
00 s
Song Title: Raizing Logo
Song End..48 / 1.52 ...
Done.

Well done! :fly:
  • User avatar
  • ValleyBell Offline
  • Posts: 4745
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

kodi wrote:Q1: How to disable WT output and FM output for YMF278B?
Your MuteMask value is wrong. It is a bitmask (with "0x" meaning "hexadecimal") with one bit per channel.
The OPL3/OPL4 FM part has 18 melodic channels + 5 rhythm channels, so your bitmask needs to have 23 bits set in order to mute everything. (0x7FFFFF)
The OPL4 PCM part has 24 PCM channels, so you need to set the bitmask to 0xFFFFFF in order to mute everything.

Sonyc doesn't use any of the FM channels btw.
kodi wrote:Q2: How to convert Yamaha YMF278B Demo MIDI files to VGM format?
I don't know. We don't have any mid2vgm tool for OPL4.
If you say "YMF278B Demo MIDI", did it come with some MIDI player? If so, try playing it back using that MIDI player and log that.

lo zaffo wrote:I really don't want to make just noise in this thread, but today I updated and compiled from source libVgz and tested a bit its player.
I'm very happy with it. :beer:
That's great to hear. :)

About the DirectSound thing: DirectSound requires you to give it a valid Windo handle in order to work. I didn't do that in player.cpp until a few days ago. I fixed it while trying to improve thread-safety.
  • kodi Offline
  • Posts: 2
  • Joined: 2019-02-24, 4:51:57

Post by kodi »

ValleyBell wrote:
kodi wrote:Q1: How to disable WT output and FM output for YMF278B?
Your MuteMask value is wrong. It is a bitmask (with "0x" meaning "hexadecimal") with one bit per channel.
The OPL3/OPL4 FM part has 18 melodic channels + 5 rhythm channels, so your bitmask needs to have 23 bits set in order to mute everything. (0x7FFFFF)
The OPL4 PCM part has 24 PCM channels, so you need to set the bitmask to 0xFFFFFF in order to mute everything.

Sonyc doesn't use any of the FM channels btw.
Thank you, your masks work and yes, I can confirm Sonyc is pure WT, no FM.
ValleyBell wrote:
kodi wrote:Q2: How to convert Yamaha YMF278B Demo MIDI files to VGM format?
I don't know. We don't have any mid2vgm tool for OPL4.
If you say "YMF278B Demo MIDI", did it come with some MIDI player? If so, try playing it back using that MIDI player and log that.
Actually, Yamaha made reference driver for PC for YMF278B and as result of that it was put on a lot of high-end sound cards of that time like Audiotrix Pro card. So, I meant demo MIDI files that come with that particular sound card. I am new to VGM and YMF278B emulation, but in the last days I educated myself and I believe I understand what is the missing link:

MIDI file --A--> MIDI player --B--> OS/Driver/MCU, etc --C--> YMF278B

basically it seems VGM is the data-dump done on point C, i.e. raw commands send to the YMF278B. What is missing to make MIDI-to-VGM for YMF278B possible is what particularly in PC is done by Yamaha driver - it translates the MIDI commands to proper YMF278B raw commands.

I need to see if I can find way to reverse-engineer that part of the Yamaha driver. However, anyone interested in that can google for "OPL4.DRV".

In fact doing that myself few seconds ago I found another card I've never heard before "AudioBlitz" - the package contains demo MIDIs, not clear if they are OPL4, but more interesting their driver has "midimap.cfg" - another think I've never noticed with Audiotrix or maybe it's not there - need to check. I guess that CFG allows for even more flexible mapping which MIDI channels are FM and which WT, because with Audiotrix is just first X MIDI channels are assigned to WT and the rest (16-X) to FM.

I think at this point it's not even clear all PC sound cards with YMF278B - I am sure many renamed "OPL4.DRV" to something else, which makes it hard for finding them on a search, but there are many, even noname ones.

So, I believe instead capturing in hardware to learn more about YMF278B, disassembling Yamaha own driver for PC could be valuable source of information.
Post Reply