Here are the things that can go wrong, right at the start so you can
find them easily.
VGM files play too fast
If you have in_gym then disable its VGM handling. It is weird.
Look at the 50/60Hz options in the config screen -
maybe you're used to 50Hz music?
Anything else
Please contact me!
Introduction
This is a Winamp (2.xx and 5.xx) plugin for playing VGM files. VGM is a
standard for logging of SN76489/SN76496, YM2413, YM2612 and YM2151
music chip data, originated by Dave, allowing various systems' games'
music to be stored. See http://www.smspower.org/music for more
information, and to download VGM music files.
To use: put in_vgm.dll in Winamp's plugins\ folder (usually C:\Program Files\Winamp\plugins\), and restart Winamp. If
you got the self-installing version then it should already be working.
Load .vgm or .vgz files in Winamp; go to the "File types" preferences
page to associate these extensions:
Open the Preferences dialogue box (press Ctrl+P, or right-click and
choose Options -> Preferences...)
Choose "File types" from the tree on the left (it's the second item
unless Winamp has changed since I wrote this)
Make sure "vgm" and "vgz" are selected in the
"Associated extensions" list (if they aren't in the list it's because you have
another buggy plugin installed)
Be sure to check out the file info and plugin configuration dialogues.
Credits
The YM2413 emulation engine is EMU2413 by Mitsutaka Okazaki, which is
part of MSXplug.
The YM2151 engine is from MAME
and was added by BlackAura.
zlib decompression is by Jean-loup
Gailly and Mark Adler.
Replay Gain data is stored in an SQLite
database, thanks to D. Richard Hipp et al.
VGM7z support uses the 7-zip and LZMA SDK from
7-Zip, by Igor Pavlov.
Dialogue boxes
VGM file & GD3 tag information
To open:
In the main window, press Alt+3; or
double-click on the track title; or right-click and choose
View file info....
In the playlist editor, select some files and press
Alt+3; or right-click and choose
File info; or press the
Misc button, choose
File info and then
File info....
In the media library, select some files and press
Alt+3; or right-click and choose
View file info....
This shows you information about the file and, if it has a GD3
information tag, it shows you information from there too. It's similar
to the ID3 information box for MP3s, except that you can't edit the GD3
tag from within Winamp.
Choose English or Japanese
to display the GD3 information for that language, if available.
If you see something like "????" for a GD3 entry then your version of
Windows doesn't support Unicode, or translation from Unicode to a valid
MBCS. If that makes no sense to you, you probably don't care about it.
Windows XP is generally OK so long as you have east asian fonts installed.
Click on View GD3 in browser to open either
"Now Playing" (the MiniBrowser in older versions of Winamp) or your
regular web browser (depending on the setting, see below), with a page
showing the GD3 tag. Chances are, if you have the necessary
fonts installed, this will be able to display the Unicode text properly
on older versions of Windows.
Click on Configure plugin... to open the plugin configuration
dialogue box.
If you open this dialogue box for several files in the playlist editor,
it will appear once for each file. Press Esc or
close the window using the frame controls to abort showing it once per file.
VGM plugin configuration
To open:
Open the "VGM file & GD3 tag information" dialogue box; then press the
Configure plugin... button or press
Alt+P.
Or open the Winamp Preferences dialogue box (Right-click ->
Options -> Preferences...;
or press Ctrl+P), choose the
Plug-ins -> Input page, then double-click on the "VGM input plugin
v0.xx [in_vgm.dll]" item, or select it and click on the Configure button.
Playback tab
GD3 tags tab
SN76489 tab
YM2413 tab
YM2612 tab
YM2151 tab
VGM7z tab
Bottom part of window
Immediate update
If this is selected, the effect of changing some of the settings will
be instant, but it may introduce jumps or pauses to the sound,
depending on the output plugin and the type of VGM file playing. If
it is not selected then the effect will take the length of the output
buffer (usually two seconds) to be heard.
Note that cancelling this dialogue box does *not* restore the previous
settings for many options.
Actually asked questions
y doesnt the winamp show vgms as associted files? i always have to
select .vgm .vgz from the drop down menu.
This is a bug in Windows, at least up to XP (SP2). Try using other methods
to load your files. The Media Library is really good, try it!
FM music is not based on SINE waves, is it?!
Yes, it is. "Frequency modulation" means using one sine wave to change
the frequency of another, thereby producing quite complex waveforms
from two simple sine waves, a Good Thing when it comes to making cheap
sound chips. Although one source says "Note that the name 'FM' is a
misnomer; in actual fact the Yamaha chips all use phase modulation (PM)
to create their sounds." So now you know.
The latest VGM plugin is much slower on my p133. The last one works
fine, but with the new one the songs stops and then continues after a
second all the time. Why?
Because FM emulation is a lot more complicated than PSG emulation, so
it takes more time. You might like to get VGMTool to optimise any VGMs
with unnecessary chip data in them, or possibly re-download the files
if they've been updated with optimised versions.
How to play VGM files direct from your webpage
You can make it so people can click on a link and have a VGM played in
Winamp the same way as you can do it for MP3s...
Make a playlist file for the file(s) you want, listed as full URLs
Link to that
Winamp will try to make it so the playlist file is downloaded and
opened by the browser with as little prompting as possible, and in_vgm
hooks up with Winamp's downloading routines to play the files
themselves. Try
this link for an example.
Known issues
You can choose to loop a VGM a lot of times. However, Winamp doesn't
handle extremely long track lengths very well.
On my computer, turning on the equaliser will make it use 3 times as
much CPU for PSG tunes, and 1.8 times as much for FM. It also does not
process square waves well. I recommend you turn it off if you can.
I tried a DSP plugin, "Dee". It crashed Winamp whenever you turn on the
3D thing, I have no idea why. So don't do that.
When you apply fake panning to PSG/YM2413 channels,
it is hard to make the apparent volume stay the same. I am trying to use
"equal power panning laws" but I'm not sure I've got it quite right yet,
especially since it seems nobody agrees on what's the right way to do it.
History
0.36 beta
Added optional MAME-based YM2612 engine
Modified MAME engine to support separate DAC muting
Added support for the global playback thread priority setting
Added unscientific multi-author string reformatter to standardise things
Added support for "%family%" metadata (good for Winamp install)
Changed some of the icons to ones from the free Silk set
Rearranged some "legacy" settings
Added more tag fixing options
Removed PSG volume curve setting UI (functionality was removed already)
Improved M3U file detection for track number guessing
Added Replay Gain support
Fixed length calculation bug
Added transcoding support
Added VGM7z support
Fixed multi-line comments (again)
Updated YM2612 engine from Gens32, now supporting SSG-EG
Unicode tag support for Winamp 5.25, while still supporting old Winamps
All GD3 tags are now internally trimmed of leading/trailing whitespace to stop badly tagged files showing up strangely in the ML
Feature death: Winamp has killed plugin control of Now Playing. You can
try this
plugin but it doesn't work for me.
Better support for out-of-spec GD3 dates
Changed dialogues to use Tahoma font to get its better Unicode support
Rewrote file info displayers to use common code underneath
Fixed bug with file info when file was downloaded from a URL
Fixed bugs displaying long formatted times
Changed seeking method to avoid inter-thread issues - hopefully, that
means no more crashes when seeking or muting channels.
Fixed fake panning to maintain equal power when panned (I think)
Fixed crash reading extended file info on files with no GD3 tag
Added per-chip enabling and preamplification controls
Settings saving is now updated for Winamp's user profile support
Added per-channel muting for YM2612
Added "loop forever" option
Improved HTML information display
Added fake stereo randomisation (off by default)
Fixed Title Casing for legacy title formatting
Fixed bug with port numbers in URLs in URL handler
0.34 7/12/05
Added high-pass filter for PCM to Gens sound core (by Blargg)
Pausing after non-looped tracks was broken in 0.33
This also broke skipping with short tracks
Fixed a couple of typos in the readme
Improved HTML information display
0.33 20/11/05
Added support for YM2612 sample banks and VGM 1.50
Fixed some stupid old bugs with unlooped VGMs that nobody ever noticed
Updated zlib to latest version
(Hopefully) removed dependency on MSVCRT*.DLL
Added file sniffer functionality so it will automagically play VGM
files even if you change the extension (although that's not
recommended)
Improved file info box chip usage display
Added tag caching for tag queries, to speed up media library tag
retrieval
Changed to NSIS installer and packed in another demo VGM
Added YM2413 panning support
0.32 30/10/05
Added icons to config dialogue
Fixed issue with Now Playing loading information pages over the HTML
information display
Added file length information into HTML information display
Updated downloader code to use Winamp's built-in downloader instead of
using IE
Added msvcrt71.dll to installer
Enabled support for VGM 1.10
Re-integrated and extended Charles' MAME-style SMS Plus conversion of
sn76489.c to hopefully make it more discoverable and re-usable by
others
Added PSG panning support
Reorganised config interface
Added magical track number extraction for the Media Library by
guessing the filename of the associated playlist file and finding
which number entry it is in there - works well for most SMS Power
releases, at least
Fixed Media Library year problems
Improved time formatting
Added YM2413 panning support
Added panning Gaussian randomisation
Improved emulation of non-Sega variant SN76489 for
the Beeb fans
0.31 12/12/04
Added Media Library extended title support and lots of associated
options
And various other stuff too
0.30 28/5/03
Added pause between tracks and looping fadeout options
Updated to EMU2413 0.60: "Fixed HH&CYM generator and all voice datas."
Unupdated back to EMU2413 0.55 - percussion sounds terrible!
Added support for VGM v1.02 (custom PSG noise feedback)
Replaced MAME YM2612 core with Gens 2.10
0.29 31/10/02
Added PSG noise boost option
Added PSG smooth volume curve option
Fixed bug in GD3 tag display
0.28 12/9/02
Configuration now uses a tabbed dialogue
Added WinXP "visual styles" support
Japanese text now shows under WinXP (hopefully)
Seeking bugs fixed
Cancelling the File Info dialogue box for a group of files now works
properly
Improved mixing
Volume levels now match better for different chips
Fixed a typo which caused the YM2162 core not to be closed
Added some documentation to this file
Added a Help button which opens this file
0.27 1/5/02
Fixed a bug with invalid GD3s
Updated to YM2413 0.55, which included a higher quality mode (12%
higher sampling rate plus conversion). Use "High quality YM2413"
checkbox to control it.
Modified PSG core to produce output similar to FM cores, ie. much
quieter
Added Overdrive mode which amplifies the sound to
levels similar to a typical MP3 file. It can cause clipping, though.
0.26 14/4/02
Added MAME YM2151 FM core thanks again to BlackAura
Fixed credits in About box
0.25 8/4/02
Fixed PSG 2-byte noise write behaviour based on chip tests
Added MAME 0.36 YM2612 core thanks to BlackAura
Finally fixed the seek bug
0.24 25/3/02
Improved PSG tone channel oversampling (or rather sub-sample accuracy)
a huge amount - aliasing is gone and it sounds great. It's now always
turned on.
Rewrote PSG noise simulation to be 100% accurate to how the real chip
works
Reverse engineered SMS SN76489 (PSG) feedback network so noise
pattern is bit-accurate
Updated to zlib 1.1.4
0.23 17/3/02
Added PSG oversampling, hoping to reduce aliasing effects but it
doesn't.
Improved channel selection, it now remembers it if you stop and re-
play a track.
Released early as I had broken the self-installer
last time
0.22 12/2/02
Total/loop lengths in file info box are now to 1 decimal place,
rather than rounded down to the nearest second
Added some protection for truncated (broken) files
Looked into why VGZ files don't show up on the Open dialogue until
you select them from the dropdown list... it's a Winamp bug, see the
AAQ above.
Worked on the internet download code a bit... note
that when you close the minibrowser, it tends to switch off IE's offline mode
:(
0.21 6/1/02
Added HTML display of GD3 information, hopefully allowing Japanese
text to be displayed on all systems
Fixed a memory leak
Loads of other stuff
Never actually got around to releasing this one
0.2 20/11/01
Ported the plugin to C
so now the YM2413 is emulated via EMU2413
ported my SN76489 emulator
ported playback engine, including variable-speed playback and
seeking
Re-implemented file downloader using URLMon.dll
(makes code simpler)
Implemented loop skipping when seeking, so you can seek through a
file looped a lot of times much faster than before
Change title formatting - now you can display Japanese text too (if
supported).
Fixed a bug when stopping/skipping just before the end of the track
Moved settings to plugin.ini in the plugins folder. You can delete
the section from winamp.ini if you like. You'll have to re-set your
preferences if you don't like my defaults.
Changed FM/PSG mixing so the Japanese BIOS music sounds better... if
anyone can send me a recording (from a real SMS with an FM chip) of
the Japanese BIOS music (or any game using both the PSG and FM chip)
I'd be grateful.
Added some stuff to the file info dialogue
Added YM2413 channel muting
Updated to EMU2413 0.51, with modifications
0.12 1/10/01
Fixed typo in About box (0.1 -> 1.0)
Added user-configurable playback rate - now you can choose to play
music at the speed you remember.
Made it so PSG flip-flops don't get stuck at zero frequency (made it
sound strange sometimes)
Changed config dialogue to Verdana font (file info already was)
Added useless icon to config dialogue. If anyone wants to design a
logo I can show it this way :)
Fixed tab order in file info dialogue
Added SMS Power URL button to file info dialogue
Fixed a bug caused by the flip-flop fix
Cleaned up source code a lot
DLL is now compressed as well as WinAligned
Ported EMU2413 to Delphi... but it doesn't work yet
Removed the above flip-flop thing because it broke voices...
On a real SMS, quite often a channel's frequency is set to 0
without turning it off. On my simulated PSG that leaves a permanent
DC offset; on a real SMS that offset decays in a fraction of a
second. The effect of this is to make the wave appear to "move" up
and down; it has a small effect on the sound, as speakers operate
better without a DC offset. Unfortunately the same effect is used
for voices, so when I activate the code to remove the offset,
voices stop working. To see this in effect, try "Out Run 3D -
Magical Sound Shower" or "Micro Machines - Title Screen", among
others.
Added HTTP downloading via WinINet.dll... which is
part of IE, but should be on almost every PC
0.11 4/9/01
Fixed a bug in the PSG tone emulation that caused problems with Micro
Machines.
Relaxed version checking, now it only insists on VGM
and GD3 1.xx and still offers to play other files.
0.1 3/9/01
Added a button to set MIME types in the registry. If a server is set
up to descibe VGM/VGZ files as "Content-Type: audio/vgm" and these
values are set, Netscape will be able to play VGM files from URLs. IE
doesn't need it, it ignores the MIME type when it sees the file
association with Winamp and will open the file properly (after a
prompt).
VGM is verging on going public, so it's reset to 1.00
and the plugin gets out of alpha
Alpha 13 26/8/01
Fixed a worse bug in the previous bugfix :P
Added track title formatting stuff
Increased play thread priority to stop skipping when
the CPU is busy
Alpha 12a 25/8/01
Fixed looping bug
Alpha 12 25/8/01
For some reason the GZip code limited the path to 79 characters,
causing "Not an AYM file" errors on files with long paths. I fixed it.
Switched to VGM instead of AYM. ****DELETE IN_AYM.DLL****
Added configuration dialogue; the tone channel checkboxes have moved
there from the file info box
Added looping support
Updated to VGM 1.12
Added loop configuration to config dialogue, saving the loop count to
winamp.ini
Added a button in the file info dialogue for the config dialogue, so
you can get at it quicker
Setting the loop to a high value allows me to test
seeking speed. 400 minutes in 8 seconds is 3000x...
Alpha 11 20/8/01
Synchronous noise tested against a real system. Apart from the
different sound due to the real system's imperfections, it works
properly now.
Updated to use the GD3 tag location properly. Decrease the offset by
0x14 in existing files for it to work. I'm not going to code for it
to handle both, sorry...
Volumes use values measured from a real SMS. I may switch to
logarithmic values, or maybe have an option eventually?
Speed modifying code added. If you want to play back
at 120Hz or 13.47Hz, you can. Except you can't, I commented that code out.
Thanks to Bock for pointing out how to do it.
Alpha 10 19/8/01
It now looks for and uses the .ayz file extension. It actually
doesn't matter which extension you give a file, compressed or not.
AYM 1.11, plus you can now choose to try and play
versions not in the supported range (1.08-1.11).
Alpha 9 19/8/01
Switched to AYM instead of DYM
Invalid files were displaying a track length before, they don't now
Added GZip support. There are problems with the
.aym.gz extension - Winamp won't automatically pass it to the plugin, because
it sees the extension as .gz. That has been worked around. Windows won't
associate .aym.gz files with Winamp, because it too sees them just as .gz
files. I don't see any way around this. GZip also ballooned the DLL size a
bit... WinAligning makes it seem even bigger. (Was: ~42KB -> 64KB after
aligning, now it's ~75KB -> 92KB after aligning.)
Alpha 8a 17/8/01
Fixed problem with DirectSound output plugin
Fixed EQ problem
Alpha 8 17/8/01
Fixed an error which cause all sound to be half the correct frequency
(1 octave lower than it should)
That also fixed voices
Alpha 7 16/8/01
DYM 1.10, with GG stereo port writes. It's untested because there is
no test stream yet :)
Improved method of muting channels, although as far as the sound is
concerned it's the same.
Tweaked volume so the (theoretical) maximum is now 98% of the
available volume. It seems this is the "right" thing to do...
Since compatibility hasn't broken since DYM 1.08 (it
uses default values for older versions), the version checking now accepts a
range of values.
Alpha 6 15/8/01
DYM 1.09, with the PSG clock rate in the header. That
is all.
Alpha 5 15/8/01
Fixed up the channel disabling, although it's still in the info box
(it'll probably end up somewhere else). Before it took until the next
volume change on that channel to mute, now it's only the output
plugin' s buffer length that stops it being instant. Noise can be
disabled too. Unmuting still needs a volume change though.
DYM 1.08 already...
Added noise emulation according to the MAME/Hiro-shi method. It's
terrible, completely inaccurate.
Dave's Sonic DYM highlighted a problem - out of laziness, I was not
buffering the file myself, hoping that Windows would do enough. So,
every byte read was actually using quite a lot of CPU. I've now got a
32KB buffer - voices work now (almost... I'm not sure what the
problem is now, it could be an issue with DYM itself), and seeking is
incredibly fast! It took 6 seconds to seek 1 minute into the GG
Shinobi DYM before, now it's instant! Seeking nearly 3 minutes into
the Sonic DYM takes a fraction of a second. And now, CPU use is way
down. It depends on the DYM file, but it's typically around 4%, a
quarter what alpha 4 used :)
I switched to my determined PSG clock speed, but it seems to cause
some problems (with voice) if it's not what the DYM creator used. DYM
1.09 addition?
WinAligned DLL... it's 64KB instead of 45, but it now
executes from the disk cache on Win98 and higher.
Alpha 4 13/8/01
Added proper file info box, without invoking Delphi's RTTI filesize
overhead. It's a lot more hassle :( but it's kept the plugin at 44KB.
Rewrote tone generators to act EXACTLY like the hardware (counters
and flip-flops). The last version used another method which I thought
up based on maths and stuff like that, which sounded OK until the
sound started using vibrato, in which case it sounded terrible. Now
it sounds perfect (except for emulation of the "fading"
flip-flops...). As an added bonus it seems to be a bit faster too,
the decoding thread uses about 16.2% CPU for me now.
Added VERY quick and dirty noise emulation. It's just volume*random(),
and sounds crappy. It's better than nothing though. It also accounts
for about 25% of the CPU use...
Added DYM version checking, because some people were
trying to play old DYM files and crashing Winamp... :)
Alphas 1 to 3
I didn't record what I did then...
...but I ought to thank Jason for help translating the C.
while (! *((int *)b) )
is quite confusing, I think
while integer(b^)=0 do
is much more readable :) (translation: while what pointer b points to,
typecast as an integer, is zero, do...)
Forget that, Jason's an asshole and I understand C now.