Skip to content

noob questions about the specifics of VGM

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

Moderator: Staff

  • User avatar
  • mlavengood Offline
  • Posts: 7
  • Joined: 2016-01-15, 22:15:15
  • Location: New York City

noob questions about the specifics of VGM

Post by mlavengood »

Okay, I'm a noob. Please help! I'm sure these questions have been asked before but I'm having trouble finding answers since most posts are geared towards composers, which I am not. I'm a PhD student writing a dissertation on timbre and I want Sega Genesis music to be part of my dissertation. So on to my point...

I am trying to do a couple things:
  • 1. Reproduce Sega Genesis Sonic music on my computer as accurately as possible
    2. Make audio recordings in a standard format (.wav, .mp3, etc.) of isolated instruments from each of these tracks.
It looks to me like DefleMask is a great tool for me to do this. I've loaded the Green Hill Zone track included as a demo and I'm able to turn instruments' sound on and off. But when I export the song as .vgm, all the tracks are present. I want to export one isolated instrument at a time: bass, then lead, etc. So my first question is how do I do this?

My next question is, is there some kind of repository/collection of other .dmf files for the Sonic games that I can access? I could transcribe everything myself but it'd be nice if I didn't have to spend that time.

Finally, are these .dmf files indeed transcriptions by other users in the community, or are they somehow taken out of the video games themselves?

Thanks for helping me out guys. This stuff is so cool!
Last edited by mlavengood on 2016-01-28, 0:23:35, edited 1 time in total.
  • Tom Offline
  • Ragequit Member
    Ragequit Member
  • Posts: 496
  • Joined: 2011-11-30, 17:26:44
  • Location: Italy
  • Contact:

Post by Tom »

Well, I know almost nothing about Deflemask since I never used it, but from what I know, it's only a tracker, so the Green Hill Zone song you're referring to is likely to be a handmade recreation and not the original thing. But I might be wrong.

Now, to look at your question from a different angle.

As you might have noticed, the VGM format supports a whole lot of gaming system. However, you won't find Genesis VGM files here, as they're already on Project 2612. From there, you can download the VGM packs for all the Sonic games. Once you have them, you can find some VGM players right here. And this is where things become trickier, since you can perform channel-by-channel muting in vgmplay.exe and in the Winamp plugin (I recommend to use this, since it can do it on the fly while the former uses an ini), but there is no way to perform instrument-by-instrument muting. There are several cases in which a channel uses the same instrument throughout all the song, but there are other complex songs in which instruments are changed, so I'm not sure if that would be enough for what you're looking for. Furthermore, the same instrument might be used on more than one channel, and recording chords with this system would add another layer of difficulty. The only easy thing in all this is that 2 or 3 channels can only be square waves and it would be trivial to take them apart.

Unless someone can suggest you an easier solution, I'd personally alter the sound data in the ROM itself if I had to be sure to do a perfect job. I'd zero all the parameters of all the instruments except for one, repeating the process for each and every instrument. Then again, I know SMPS and I have a lot of time to waste.
Also known as nineko.
  • User avatar
  • mlavengood Offline
  • Posts: 7
  • Joined: 2016-01-15, 22:15:15
  • Location: New York City

Post by mlavengood »

Okay, thanks. So I think I've figured out that Deflemask is basically irrelevant. I got Audio Overload working. So for the Sonic files on Project YM2612, the channels I need to play with are the YM 2612 channels, right?

I have some other probably fairly basic questions (sorry). I'm not sure I totally understand where this comes from. Is Project YM2612 somehow getting these files off the games themselves? Or are people recreating them from ear? I am very experienced with music and I know my way around computers, but I am brand new to this video game music community...
  • User avatar
  • grauw Offline
  • Posts: 150
  • Joined: 2015-02-22, 3:40:22

Post by grauw »

They’re getting them from the games themselves, the communication from the CPU to the sound chip is recorded.

Post by Kaminari »

Members of Project 2612, like VGM Rips, record the soundtracks straight from the games in VGM format.

Deflemask is a tracker that is used to create new pieces of music.
  • User avatar
  • mlavengood Offline
  • Posts: 7
  • Joined: 2016-01-15, 22:15:15
  • Location: New York City

Post by mlavengood »

Should I start a new topic since DefleMask is irrelevant or just keep asking here? Ha.

When the communication from the CPU to the sound chip is recorded—what is in that communication? Signals about which note to play and for how long, obviously... but where does the data about each instrument live? Is that on the sound chip or on the game, or on the CPU?

If there is just a website I should go to to read up on this, definitely link it. My problem has been though that this is such a niche community that most things are written with experienced readers in mind, not a noob like me.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

It comes from the game ROM, and is transferred by the CPUs to the sound chip registers. There's some quick documentation for the YM2612 and YM2151 respectively. You can see by running the vgm2txt tool on any VGM file. If you're familiar with FM synthesis, it should be pretty straightforward.
  • Tom Offline
  • Ragequit Member
    Ragequit Member
  • Posts: 496
  • Joined: 2011-11-30, 17:26:44
  • Location: Italy
  • Contact:

Post by Tom »

mlavengood wrote:Should I start a new topic since DefleMask is irrelevant or just keep asking here? Ha.
You can edit your own topic title by editing the first post.

Now back to your relevant questions.

To put it in simple words, imagine you have one of those MIDI keyboards which let you save what you play. VGM files work in a similar way. They're not extracted from the game code (look at the Wiki on this very website to find out more about this, I wrote most of that paragraph). Someone (typically Maxim before and Valleybell later) modified an emulator to intercept all the data writes to the sound chips (in your case, the YM2612). So, at a certain point, the game code of Sonic 1 says "hey YM2612, set register 5 to value 42", and this gets logged into the VGM file. At replay stage, your media player of choice acts like one of those automatic piano players seen in western movies, replicating the commands at the right time as defined in your VGM.

FM synthesis isn't that hard to figure out but it can be intimidating if you know nothing about it. I cba to read the whole Wikipedia article about it because I don't have much time right now, but the pictures on the right seem to be correct. Basically, the YM2612 has a bunch of registers which are used to set various parameters to various values to obtain what the pictures on Wikipedia describe, in various ways. I doubt I can use even simpler words while still giving you correct-ish informations.
Also known as nineko.
  • User avatar
  • mlavengood Offline
  • Posts: 7
  • Joined: 2016-01-15, 22:15:15
  • Location: New York City

Post by mlavengood »

thanks for all the help guys. What's the logic behind which instruments get assigned to which channels? I'm looking at Hill Top Zone from Sonic 2 and channel 1 is the reed/brass, channel 2 is the bass, but channel 3 is also the same reed/brass sounds, channels 4/5 are organ, and channel 6 is percussion. So why is the bass in channel 2 separating the reed/brass pairs?
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

There usually isn't any real logic. It's all up to the composer. I think usually the composer ends up working on the melody and bass tracks first and that's why they often end up on channels 1 and 2 respectively. In Sonic's case, the music was actually first written down by the composer and then transcribed by Sega's programmers.

The only "fixed" thing with the chip is that percussion is usually always on channel 3 and 6. Channel 3 since it allows for frequency control on all FM operators (for an example, Space Harrier II and Streets of Rage can use Channel 3 to play several drum sounds simultaneously), and channel 6 since it allows direct access to the DAC (digital-analog converter), allowing for playback of drum samples.

However, for games that use the GEMS sound driver, the channel is allocated dynamically whenever time a note is played. So you might see the bass move from channel 2 to channel 4 and so on, depending on which channels are free at the time.
  • Tom Offline
  • Ragequit Member
    Ragequit Member
  • Posts: 496
  • Joined: 2011-11-30, 17:26:44
  • Location: Italy
  • Contact:

Post by Tom »

As said by ctr, it's all up to the composer, with the exception of the DAC channel which is necessarily the 6th one. Please note that this doesn't imply the vice versa: if you want to use PCM drums, they have to be on the 6th channel, but the 6th channel isn't necessarily used in DAC mode and can be regularly used as FM6. The two modes are mutually exclusive (e.g. you can't use 7 channels at the same time), but you can switch between FM and DAC mode on the fly mid-song (though in practice I don't think there are any examples of this). Not many Sonic songs use 6 FM channels, the most notable example is Sonic 1's special stage, which in turn has led to the theory behind 1-UPs being removed from the special stages (the 1-UP jingle uses drums and the smps driver "forgets" to reset the sixth channel to FM mode once the 1-UP jingle is over, you can still experience this by collecting 100 rings).

However, there are a couple of unwritten ground rules when it comes to the main Sonic games (1, 2, 3, K). Songs and sound effects have to share channels, you might have noticed that some instruments get temporarily muted when you collect a ring. Most of the sound effects usually are on FM4 and FM5 (e.g. the rings themselves), some of them are on FM3 (e.g. the crumbling platform), while FM1 and FM2 are never muted. For this reason, FM1 and FM2 are usually used for the "important" parts of the songs such as lead and bass, while FM4 and FM5 are usually used for complementary stuff such as echoes and chords. FM3 is somewhere in the middle, it might contain a secondary lead or the most important note of a chord. Furthermore, instrument assignments aren't set in stone, and can be changed at any time during a song (though it's rarely done in official songs, except for long ones (e.g. Sonic 3 & Knuckles' ending)).

Sky Sanctuary is a prime example of extremely bad channel assignment. I'm sure you noticed that the lead gets muted all the times during casual gameplay, I wonder if the sound technician was drunk when he placed the lead on FM5, making it muted every other time you collect a ring. All of this while FM2 is used for some quiet thing you aren't likely to hear anyway. Swapping FM2 and FM5 in the smps song header makes the song way more enjoyable.

Also, don't forget that the Mega Drive / Genesis also uses an SN76496 alongside the YM2612, something I hinted to when I talked about square waves in my earliest post in this topic. The SN76496 can output 3 square waves at the same time, plus a noise channel. In practice, the smps driver has a soft limit and it can either use 3 square waves and no noise channel, or 2 square waves and the noise channel. Those channels are usually called "PSG" (Programmable Sound Generator). The same unwritten ground rules apply: the PSG channels are muted by sound effects as well (PSG1 by jumps, PSG2 by brakes, PSG noise by the water splash and the badnik/monitor explosion, ...). You can't change the duty cycle of the square waves (they're all 50%), all you can do is play with volume envelopes. I won't talk about the special mode of the noise channel since Sonic games don't use it. Unless you want to know about it anyway.

You should also look into some of the Homebrew songs around here.

Also please note that I went back and forth while writing my post because things came to my mind in a sparse order so you should read it twice in case you miss something. I admit in advance that it will be my fault. Yes, I know I said "also" in my last three sentences. I am random.
Also known as nineko.
  • User avatar
  • ValleyBell Offline
  • Posts: 4768
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

ctr wrote:and Streets of Rage can use Channel 3 to play several drum sounds simultaneously), and channel 6 since it allows direct access to the DAC (digital-analog converter), allowing for playback of drum samples.
Streets of Rage actually uses channel 3 in normal mode, in combination with the DAC channel. (It's still a pretty clever way to do nice-sounding drums.)
Tom wrote:instrument assignments aren't set in stone, and can be changed at any time during a song (though it's rarely done in official songs
That's not true, actually. It's pretty common to change the lead instrument throughout the song. And the songs from Sonic 3/Knuckles (especially Angel Island 1/2) almost spam instrument changes.
  • User avatar
  • mlavengood Offline
  • Posts: 7
  • Joined: 2016-01-15, 22:15:15
  • Location: New York City

Post by mlavengood »

Tom wrote: Not many Sonic songs use 6 FM channels, the most notable example is Sonic 1's special stage, which in turn has led to the theory behind 1-UPs being removed from the special stages (the 1-UP jingle uses drums and the smps driver "forgets" to reset the sixth channel to FM mode once the 1-UP jingle is over, you can still experience this by collecting 100 rings).
So the drums in channel 6 in Sonic games are sampled and not FM generated? Or am I misunderstanding you?

Also is there a VGM player that will let me monitor the levels of all the channels being used? I want to easily see what is active when. Right now I could sort of map that out by hand but it would be tedious.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

mlavengood wrote:So the drums in channel 6 in Sonic games are sampled and not FM generated? Or am I misunderstanding you?
Tom meant the Special Stage music in Sonic 1. It has no drums at all and uses all 6 FM channels for melody. All other songs use sampled drums.

So that is, If you get a 1up in the special stage, channel 6 switches to DAC mode for the drums in the 1up jingle, but the driver forgets to switch it back when resuming the special stage music, which means one of the voices will be missing.
mlavengood wrote:Also is there a VGM player that will let me monitor the levels of all the channels being used? I want to easily see what is active when. Right now I could sort of map that out by hand but it would be tedious.
Currently there are no VGM players that can show levels for each channel. You have to record each channel independently and use a track editor like Audacity. It can be done somewhat automatically by creating a bunch of different VGMPlay config files and then using a batch script to switch between them to record each channel independently.

There are some players like Hoot that does show the levels (and even displays a piano roll) of all channels, but it does not play VGM files at this point.
Post Reply