Quick and dirty Ruby script to rename MoonBlaster files

By FiXato

Scribe (1520)

FiXato's picture

12-05-2018, 18:34

A while ago I downloaded the MSX Musics archive from WORP3's website. Today I wanted to listen to some of the MoonBlaster files only my desktop PC using XMPlay with the MSXPlug plugin installed. The default 8.3 files were rather non-descriptive though, so I figured I'd try to extract the song-titles from them, and maybe see if I could automatically rename them.

In the end I ended up with this MoonBlaster metadata/renamer Ruby script that extracts the track name and sample kit name, and tries to find any MBK, MBD, and MWK files that match the sample kit name. It also copies renamed files into sub-directories based on the sample kit.

It's far from perfect, but for now it does what I want it to do, so I thought I'd share it with the rest of you. :)

Note: it currently relies on the Zaru Ruby gem for filename sanitisation, and I don't have a Bundler Gemfile set up, so you'll have to manually `gem install zaru` before running the script.

Login or register to post comments

By FiXato

Scribe (1520)

FiXato's picture

12-05-2018, 18:35

Maybe useful to WORP3, it seems the following 45 sample files are missing from the msx_musics.rar archive:

1
1_______
4
ACEDRUM
ACEDRUM1
ACESFX
AIRPART_
BAIKAENZ
BASSKID
CAMELLYM
DANCING
DARKMBK7
DEATH
DELUXE
DIISK09
DTSAMPLE
GALAXY
IODRUM1
IWASATEE
JAM
KINGS
KIT
MAGIC
MCFN1
MCFN3
MCFN5
MEDIAGNE
MOAKIT
MOA_KIT
MONTY
MUZAK_II
PEPIDEAD
PINOCHIO
POPCORN
RESERVE
SACRAFIC
SAMPLES1
SP_ACE
TEMP
THEMESN
TJA_DRUM
TRCKSAM1
TRIP
TWINSOFT
ZODIAC

By Pencioner

Paladin (927)

Pencioner's picture

12-05-2018, 23:39

Thanks @FiXato that's of course very useful tool! I'm going to take another try to that tunes, because once i didn't want to spend a lot of time renaming files, and it was hard to consistently run-n-listen Wink But now that should be as easy as running ruby script - not too complicated until you used some really obsolete (1.6 or 1.8) version Big smile

By FiXato

Scribe (1520)

FiXato's picture

13-05-2018, 00:02

The Ruby version installed on my desktop is 2.4.2, but I don't really target any specific version. I wouldn't be surprised if it worked without much problems on 1.8 too Smile Well, apart from the Zaru gem perhaps, but that could probably quite easily be replaced with a simple regex replace too.

I did notice some inconsistencies between the files, which might be a difference in MB 1.3 and 1.4 files? Some of the files seemed to have their sample kit name stored 1 byte further, at $0141 rather than $0140 (according to MoonBlaster File Format specs), and also the track name is supposed to have a length of 41, but I found that the 41st byte often to be a smiley character rather than part of the track name, so I set the length to 40 instead.

The archive contained .MBD files; what are these? I'm guess MoonBlaster Drumkits, but aren't they supposed to be part of the .MBM files?

I'm guessing that .MWK files are the wave kits for MoonBlaster Wave? Is there an open file format spec for those too, so I can perhaps at least extract the instrument names from those?

All in all it's a shame that the MoonBlaster file format had such a limited metadata support; would've been nice if we'd at least had a separate field for the composer/arranger, instead of being forced to put it in the track name.

I can understand the need for putting the wavekit in a separate file to prevent duplication, but it also would've been nice if there was support for a concatenated format that included both, for easy export/distribution.

By FiXato

Scribe (1520)

FiXato's picture

13-05-2018, 00:09

In a future version I might try to determine what part of the track name is the artist name, and year, but without an actual standardised format, there are bound to be false matches. Smile

By Meits

Scribe (5480)

Meits's picture

13-05-2018, 00:50

It's always been a pity you can't 100% trust the MBM/MWM files to be accurate with the MBK/MWK info they've stored. Plus playing back MBM files outside their release product might cause it to be played in the wrong frequency.