Skip to content

My random ports

Original compositions, as well as ports and remixes of existing songs, can be posted in this forum, as long as they are in VGM format of course.

Moderator: Staff

  • xan1242 Offline
  • Posts: 7
  • Joined: 2015-03-19, 20:12:47

My random ports

Post by xan1242 »

So, I have managed to port a couple songs almost hassle free by using mdxtools, vgm2mid and mid2smps, but I'm still running into a few problems.

First of which is pdx2wav's sample length calculation:

Code: Select all

if(p.samples[j].length > 0) {
					uint8_t *data = p.loadSample(j);
					int16_t *wavData = new int16_t[p.samples[j].length * 2];
					ADPCMDecoder d;
					d.decode(data, p.samples[j].length * 2, wavData);
					char buf[256];
					snprintf(buf, sizeof(buf), "%s-%d.wav", argv[i], j);
					WAVWriter::write(buf, wavData, p.samples[j].length * 2, 15600, 16, 1);
					delete[] data;
					delete[] wavData;
				}
Increasing the multiplier there indeed extends the sample (and extracts it by its correct length), however the samples are then of noticeably lower quality and are louder than usual, so samples in the song are right now of shorter length, rather than sacrificing quality.

Second problem is mainly the way mid2smps driver calculates volume, but that's probably due to nature of SMPS itself. VGM2MID volume calculations don't translate too well to mid2smps. You can notice it in the song how much louder they are to their original counterparts.

Third problem is again probably due to the nature of SMPS, but modulation didn't translate as well as I'd hoped (on YM2612 only) as the songs use incremental modulation values as opposed to constant ones. SMPS doesn't like that and it just goes apeshit until it reaches 127.

And lastly, I couldn't figure out the tempo calculation on mid2smps. I did it once before and now I can't remember what sorcery did I pull off...

Here are the songs (ogg only for now):

Etude For The Killer
Bloody Tear

Don't mind the shitty recordings, my Windows installation is goofed (directsound's buffers just die out for some reason).
Last edited by xan1242 on 2016-11-17, 12:17:55, edited 1 time in total.

Post by vampirefrog »

xan1242 wrote: First of which is pdx2wav's sample length calculation:

Code: Select all

if(p.samples[j].length > 0) {
					uint8_t *data = p.loadSample(j);
					int16_t *wavData = new int16_t[p.samples[j].length * 2];
					ADPCMDecoder d;
					d.decode(data, p.samples[j].length * 2, wavData);
					char buf[256];
					snprintf(buf, sizeof(buf), "%s-%d.wav", argv[i], j);
					WAVWriter::write(buf, wavData, p.samples[j].length * 2, 15600, 16, 1);
					delete[] data;
					delete[] wavData;
				}
Increasing the multiplier there indeed extends the sample (and extracts it by its correct length), however the samples are then of noticeably lower quality and are louder than usual, so samples in the song are right now of shorter length, rather than sacrificing quality.
Shit, did I write that? Not sure I understand what you mean, can you explain with code please?

Or perhaps you would benefit from a raw extractor better? I.e. something that extracts the samples directly, without decoding them from ADPCM?
  • User avatar
  • ValleyBell Offline
  • Posts: 4767
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

Although I can't give you tips about pdx2wav (never used it), I can explain a few details about vgm2mid and mid2smps.


(2) For the YM2151, vgm2mid doesn't convert the FM volume values correctly to MIDI volumes. (It just uses MidiVol = (127 - FMVol), the correct formula would be more complicated.)
mid2smps instead uses the correct formula to convert MIDI -> FM volumes.
If you'd like to fix the volumes, you need to recalculate them using this formula:

Code: Select all

newMidVol = 10.0^[(vgm2midVol - 127) * 0.75 / 40.0] * 127
(3) SMPS doesn't like rapid modulation changes indeed, because it resets the whole modulation effect everytime a Modulation controller is used. You can only manually reduce the modulation controllers. I usually have not more than 1 Modulation controller (that is > 0) per note.

(4) You need to edit the "Ticks per Quarter" and "Tempo Divider" settings and look at the Tempo Calculator to see the results. The range of available tempos is based on (TicksPQuarter * TempoDiv). Sane TpQ settings are multiples of 3 and 4.

EDIT:
vampirefrog wrote:Shit, did I write that? Not sure I understand what you mean, can you explain with code please?
You obviously did. And it makes it more funny that you can't understand your old code anymore. :P
  • xan1242 Offline
  • Posts: 7
  • Joined: 2015-03-19, 20:12:47

Post by xan1242 »

vampirefrog wrote: Shit, did I write that? Not sure I understand what you mean, can you explain with code please?

Or perhaps you would benefit from a raw extractor better? I.e. something that extracts the samples directly, without decoding them from ADPCM?
What I meant was, increasing the multiplier in every "p.samples[j].length * 2" specifically increases the length that's extracted, but the quality drops. If I can find the samples from the machines they used (Akai XR-10 for example), then I'll try to work those out if these can't be extracted better.

I dunno, if mid2smps can read them while in ADPCM then yes, otherwise I'd stick to PCM since that's easier to deal with.
ValleyBell wrote: (2) For the YM2151, vgm2mid doesn't convert the FM volume values correctly to MIDI volumes. (It just uses MidiVol = (127 - FMVol), the correct formula would be more complicated.)
mid2smps instead uses the correct formula to convert MIDI -> FM volumes.
If you'd like to fix the volumes, you need to recalculate them using this formula:

Code: Select all

newMidVol = 10.0^[(vgm2midVol - 127) * 0.75 / 40.0] * 127
Oh shite, I'll have to find a way to do it on the whole MIDI. (is there a way to do it at all?) I might end up using mdx2mid instead then if I can't, but I really don't want to since I utilized the PSG in these.
ValleyBell wrote: (3) SMPS doesn't like rapid modulation changes indeed, because it resets the whole modulation effect everytime a Modulation controller is used. You can only manually reduce the modulation controllers. I usually have not more than 1 Modulation controller (that is > 0) per note.

(4) You need to edit the "Ticks per Quarter" and "Tempo Divider" settings and look at the Tempo Calculator to see the results. The range of available tempos is based on (TicksPQuarter * TempoDiv). Sane TpQ settings are multiples of 3 and 4.
Hm, so instead of rapid changes, I'll make it so that every modulation is 127 (because they all end up that much anyway) and change the delay accordingly. That's gonna be a lot of work.

I'll try to mangle something out so I can at least make the VGMs of what I have now. Thanks for the info, though, will see about making the SMP and possibly even put it in a Sonic hack for giggles.

EDIT: Here are some VGMs of those recordings.

Etude For The Killer (mirror)
Bloody Tears (mirror)

Best settings for MID2SMPS I found out so far were TpQ = 29 and TempoDiv = 1 and it still has some issues. Also Bloody Tears' PSG got apreggio'd for some reason. Removing the FM from the MIDI fixes it. I didn't want to merge the VGMs since that would be cheating. :wink:

EDIT2: Oh god just now I noticed I used the wrong sample for the hihat in Bloody Tears, update is coming!

EDIT3: Bloody Tear v2 (Mirror)

EDIT4: (I should've put this thread somewhere else :oops:)

It's definitively possible :D (mirror)

Right now it's based off of a basic MegaPCM hack, nothing too special. I wanted to use DPCM but calculations for frequency are different then.
  • User avatar
  • ValleyBell Offline
  • Posts: 4767
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

Those port sound pretty nice indeed.
vgm2mid is the lack thing I'd use to do accurate ports though - mainly because of the broken tempo.
And 29 TpQ is a really odd number, so I wouldn't use that in mid2smps, because you won't even have even 8th notes that way. (Though with the broken tempo from the vgm2mid conversion, I guess it can't get worse because there is jitter anyway.)

Also: Tell me more about your PSG channels, because the X68k tracks don't have such channels. (X68000 is 8xFM + 1x ADPCM, MegaDrive SMPS is 5xFM + 1xPCM + 3xPSG)
  • xan1242 Offline
  • Posts: 7
  • Joined: 2015-03-19, 20:12:47

Post by xan1242 »

I'm not sure if mdx2midi is better for the tempo tho, will see... All I know is that VGM2MID is a little bit more accurate when it comes to the final product (it has modulation as opposed to mdx2mid).

Well, what they did with channels 6, 7 and 8 in most of the songs was that they either did some backing tracks (6, sometimes 7) or echo of the leading tracks (sometimes 7, mostly 8). Most of the channel prioritization has been done by Konami basically.

What I did, was that for those tracks I relegated them to the PSG in different ways using different envelopes and multiple channels to somewhat resemble the original sound. Whenever PSG channel 3 was unused, it was used as echo like the original. At least that's what I did for Bloody Tears.

Etude For The Killer on the other hand was a bit different. After the first chorus or whatever you wanna call it (00:27 to be specific) the PSG was used as the flute, echo of the flute and the high pitched sound (S3K PSG envelopes were used) just like the original, except the flute itself was on channel 2 or so, so I moved around some stuff from channel to channel as well.

Thus, almost the same amount of simultaneous voices as the original was gained, without losing too much on the sound fidelity (other than some weird chorus effects they did with the organs and guitars).

Also, any solution on the volume front? I have no clue what sequencer/editor I could use to change values easily enough. I'm currently using Cakewalk Music Creator 5 (it was used for these as well) and, albeit functional, it's quite buggy and frustrating to use the event editor.

EDIT: Tested a mdx2midi conversion, Etude For The Killer used BPM of 113, which is quite unsettling for SMPS (closest you can achieve is 112,9904 with TpQ=31, TD=1) and isn't as jittery as vgm2mid, however this is still a tiny bit off. It has proper volumes, so I'll probably rework the MDXs as well. I know there was a hacky way to recalculate the BPM while keeping the speed intact by using Modplug Tracker, but that was a long time ago so I don't remember exactly. Will try nonetheless, if that's done tho, issues with jittery notes should be eliminated completely.
  • User avatar
  • ValleyBell Offline
  • Posts: 4767
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

You don't need to get the 100% exact tempo in SMPS at all. If the resulting tempo is off by a few percent, it doesn't have an audible a difference.
So I'd go with 30 TpQ, because 112.9 BPM really is close enough and there is less jitter that way.
Maybe even use 24 TpQ - the song uses lots of 16th notes, so I really recommend TpQ to be a multiple of 4 in order to get jitter-free 16ths.
(16th notes -> 16th per quarter = 16/4 = 4 -> use a multiple of 4)

About chaning BPM while keeping speed: That introduces the same vgm2mid jitter and thus is not a good idea.
I would probably use the vgm2mid MIDI to look up how some modulation/pitch effects are done and add them to the mdx2mid.
I also recommend to play around with the mid2smps modulation settings. (General Purpose Controller #1 to #4) Those allow for easy modulation effects without having to turn modulation on and off for every note. (For details, you probably should catch me on IRC.)

Post by vampirefrog »

IIRC, I wrote the modulation into mdx2midi, but it's specifically written for the VOPMex plugin. So if you load it up in a DAW it should feature proper modulation. But I might be wrong, I haven't worked with it for quite a while.

Also, the BPM in MDX files is calculated from a BPM command (it can change in time with a new command), and is based on a calculation involving the timers of the YM2151.
  • xan1242 Offline
  • Posts: 7
  • Joined: 2015-03-19, 20:12:47

Post by xan1242 »

Since there isn't that much activity here, I decided to rename this thread. :V

Anyhow, recently (10 days ago to be precise) I ported a couple tunes from Tiny Toon Adventures to YMF262. Big shoutout to MaliceX for his MIDI driver!

(sorry for Mediafire, I needed something more permanent)

Grasslands: VGM CMI8738 OGG

Cavern: VGM (coming soon!) CMI8738 OGG

There's a bit of a problem I have with looping the Cavern one, instrument on one channel just changes after the loop point for some reason. :?
  • xan1242 Offline
  • Posts: 7
  • Joined: 2015-03-19, 20:12:47

Post by xan1242 »

Been busy so I didn't manage to loop the Cavern VGM from before... I really wish to be more active tho. I'm having lotsa fun using French Horn as a flute here :D

Anyhow, decided to do some Aladdin. Only Prince Ali for now. It was actually super simple and easy to do. I'll try to do some more (Camel Jazz in particular).

VGM (OPL3) OGG (CMI8738)
VGM (OPLL)
  • xan1242 Offline
  • Posts: 7
  • Joined: 2015-03-19, 20:12:47

Post by xan1242 »

Final Fantasy IX Battle 1 OPL3

VGM
OGG (CMI8738)

Also a small preview of it on the Sound Canvas (mostly finished):
Link
Post Reply