Skip to content

X68000 mdx files to vgm

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

Moderator: Staff

  • User avatar
  • Delek Offline
  • Posts: 41
  • Joined: 2012-05-05, 16:39:51

X68000 mdx files to vgm

Post by Delek »

Hello there!
I'm working on a tool to convert mdx files to vgm (only because I want to listen and correctly rip the Namachuukei 68 OST by Yuji Takenouchi, one of the best things in the Chiptune history imho)

The files should be 1:1 replicas of the mdx information because I'm using a direct disassembly of the X68k MXDRV music driver to dump the data! Awesome stuff! 8|
This is the 0.1 alpha version, I think there are some bugs here and there (loop points, sample volume, tempo?) so pelase help me out to test this converter.

I have made versions for Windows and Mac:
http://delek.net/mdx/mdx2vgm_windows.zip
http://delek.net/mdx/mdx2vgm_mac.zip

Usage: mdx2vgm <file>

Source code: https://github.com/LeonardoDemartino/mdx2vgm
Last edited by Delek on 2017-05-08, 3:53:39, edited 1 time in total.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

It seems to be really picky when looking for the PDX file. Apart from that, it seems to work ok on the files i tested it on (with the exception of songs using PCM8)

Code: Select all

PDX FILE: GR_PCM.PDX.pdx
cannot open GR_PCM.PDX.pdx
Error while reading .pdx file: GR_PCM.PDX.pdx.
Also, there's an asm->C disassembly + wrapper for mxdrv here but maybe it's too late for me to point that out now :P
  • User avatar
  • Delek Offline
  • Posts: 41
  • Joined: 2012-05-05, 16:39:51

Post by Delek »

ctr wrote:It seems to be really picky when looking for the PDX file. Apart from that, it seems to work ok on the files i tested it on (with the exception of songs using PCM8)

Code: Select all

PDX FILE: GR_PCM.PDX.pdx
cannot open GR_PCM.PDX.pdx
Error while reading .pdx file: GR_PCM.PDX.pdx.
Also, there's an asm->C disassembly + wrapper for mxdrv here but maybe it's too late for me to point that out now :P
Hmmm, it seems that some .mdx include the ".PDX" in the header. A workaround for now is to rename the file to PDX.pdx.

Post by vampirefrog »

I also have a mdx to vgm tool, written in C++. Mine doesn't have vibrato and some other fine detail stuff, but iirc it generates decent vgm files.

https://github.com/vampirefrog/mdxtools ... dx2vgm.cpp

BTW, X68Sound.dll uses the same technique of disassembling the X68000 MXDRV and reassembling it as a DLL somehow. Here is a link (download is at the bottom of the page).

Also, interesting enough, he uses a FIR lowpass filter on the OPM.
  • User avatar
  • Delek Offline
  • Posts: 41
  • Joined: 2012-05-05, 16:39:51

Post by Delek »

Yes vampirefrog, your work inspired me to do this actually, but I used a different approach after all. Btw I actually wrote in your repository here: https://github.com/vampirefrog/mdxtools/issues/2
but you never replied :(

It is interesting because your code tries to "replicate" the handling of events from the .mdx language directly. My solution is to run the "official" driver with the .mdx/.pdx file and dump what he does (with some variables added to it in order to detect loop points and other stuffs)
  • User avatar
  • blitzlunar Offline
  • Posts: 126
  • Joined: 2012-12-21, 15:30:24
  • Location: UK

Post by blitzlunar »

This is a great idea! I'm not a huge fan of MDX format as it doesn't integrate terribly well with modern media libraries - this seems like the perfect solution.
  • User avatar
  • Delek Offline
  • Posts: 41
  • Joined: 2012-05-05, 16:39:51

Post by Delek »

Exactly! I will release an update soon with better handling of PDX files, some improvements in the loop points and sample triggering.

Post by vampirefrog »

can you release the source please? I'd like to use it on linux

also, if there is no pdx file (empty filename) it still looks for ".pdx", so I can't use it with, for example, bomberman X68k

also, with these two files, it only plays the kick drum (probably the first sample in the pdx file), no snare, no high-hat, no toms.
Attachments
castlevania-mdx.zip
(116.06 KiB) Downloaded 271 times
  • User avatar
  • Delek Offline
  • Posts: 41
  • Joined: 2012-05-05, 16:39:51

Post by Delek »

Of course vampirefrog, I will upload the source code to GitHub in some minutes. All the bugs you mentioned are fixed with the exception of the sample triggering stuff. I'm trying to figure out how does the mxdrvg parses this data, could you help me out with this in the repo please?
  • User avatar
  • Delek Offline
  • Posts: 41
  • Joined: 2012-05-05, 16:39:51

Post by Delek »

Here is the repo: https://github.com/LeonardoDemartino/mdx2vgm

Please work in the branch fix_sample_triggering if you want to help me out with that issue. Thanks!
  • User avatar
  • Delek Offline
  • Posts: 41
  • Joined: 2012-05-05, 16:39:51

Post by Delek »

Builds updated too!
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

I think the problem with samples affect files that use PCM8. It's a PCM driver (that runs on top of MXDRV) that is used to mix 8 pcm channels, this was heavily used by MDX files. Check the x68sound.dll source code for an implementation.

For some examples of files that use PCM8 you can check here and here.
  • User avatar
  • Delek Offline
  • Posts: 41
  • Joined: 2012-05-05, 16:39:51

Post by Delek »

Wow that could be the explanation why some tunes are perfectly fine while others can't trigger some samples. So some mdx can have more than 1 pcm channel? That will complicate a little bit the stream data in the .vgms. Please confirm this.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

Correct. But the mixing is entirely done in software, so you will have to either use pcm8.h and send the data to the MSM6258 as a stream, or you could decode each sample individually and use a different sound chip (I'd suggest the YMF278B to make your VGMs compatible with the MSX).

Post by vampirefrog »

just copy what X68Sound.dll does
Post Reply