I’ve been publishing some small projects lately, so I thought it was a good time for an update on them and how things are going.
My health is still not good. I think the progression of my illness has slowed slightly as I’ve become more aware of how it functions and how to manage it. However, I’m still not aware of what it is. I’m still researching and analyzing and fighting to figure it out, though. But it is probably some kind of rare genetic metabolic disorder. Regardless, I have to take things slow and put any energies into smaller, less-intense projects.
Mod Music Conversion
One such project was converting all my old mod music into MP3s so I could listen to them more conveniently. I’ve been manually converting small batches of mods for years and found through that process that many automated ways of transcoding mods had issues. Either metadata would be left out or certain bits wouldn’t sound right or the volume was too low or the frequency balance would be muddy sounding. This is why I would always just playback the mod in ModPlug Player (my player of choice) and directly record the output into Audition, tweak the volume, save to MP3, and done. You can’t reasonably do this for a library of over 400 songs, though.
The first problem I wanted to tackle was getting as much metadata out of a module file as possible and putting it into an MP3 file’s ID3 tags. I started looking into libOpenMPT as a way to open the four major mod formats and grab their metadata in a standardized way. It’s a decent library, but the documentation could use some work. I had to read through its source code for hours until realizing that it returns strings as UTF8. This was only a problem because .Net can only marshal strings from unmanaged memory that are ANSI or UTF16 by default, which seems pretty weird given UTF8 is so common. But one custom UTF8 marshaling function later and I was in business.
The next problem was that the mod metadata ended up being not the greatest. Almost all mods have a title and a field for what tracker software was used, but modification date only became a feature by the Impulse Tracker format, and none of the main formats have artist fields. I had to use a lot of regex magic to even get a fraction of the date and artist metadata from the song comments. The comments, by the way, are another quirk of the mod formats. Artists typically put notes about their work in the comments; however, only Impulse Tracker had a specific field for this. The earlier formats used either sample names or instruments for these notes. Being that I wanted to preserve all of this in the extracted metadata, I just concatenated all three fields together with some delimiters between them.
Luckily, getting the extracted metadata into an MP3 file is a bit more simple as there are a number of ID3 libraries for .Net. TaglibSharp is the most popular one, but it is not without its quirks as well. Particularly, trying to delete specific user text frames (TXXX) is not the least bit straightforward. But in the end, I came up with an imperfect little tool to copy module metadata to an MP3 file (or output to text if necessary for your purposes) that I put up on Github. Thankfully, ID3 is a much better tagging format than what module files used. 😄
As I was trying to figure out how to work with libOpenMPT, though, I discovered that ffmpeg also uses this library to load module audio. Given that libOpenMPT was basically the evolution of ModPlug, I thought that the playback might be comparable between the two. I did some test runs converting a few songs to MP3 and found the results to be promising. Obviously, the aforementioned muddiness of the sound persists, but I then found that ffmpeg has quite a vast library of audio filters to utilize. One EQ later and that issue is fixed right up.
What was more of a struggle was how to balance the volume of the songs. Naturally, you don’t want to risk clipping the audio data by doing a straight up amplify. ffmpeg does include a hard limit filter to avoid clipping, but how do you know how much to amplify? You can’t normalize a song’s audio without having the whole song to analyze and ffmpeg only works in streams of audio data. It’s a problem I have yet to find a straightforward way to tackle. In the end, I used the loudnorm filter to extract the loudness of the song, calculated the amplitude needed to reach about -10 LUFS, and then did a second pass including the desired hard limit. More information on the whole conversion process can be found on the Github page for the metadata extractor.
Ultimately, I’m fairly pleased with the results of this project. I did get my entire mod library converted to MP3 with some snazzy album art and good sound. But I also did end up having to manually adjust a lot of the artist names and titles in MusicBrainz Picard to catch all the missing artists and make them all uniform, so that was a bit of a drag. Also, there are a few songs that seem to have minor issues with conversion accuracy, primarily Necros songs coincidentally. I may still end up manually recording a number of the songs ultimately, but what I’ve got so far is pretty damn good.
Deus Ex Soundtrack v2
Given that I was already binging old mods, my conversion of the Deus Ex Soundtrack—which was originally in the mod format—kept coming up on shuffle. However, I was getting pretty annoyed at how quiet the songs were as I had stupidly only normalized the volume instead of hard limiting it. I thought it would be a quick couple day project of loading up the original wave recordings and tweaking the volume levels, but I soon found lots of other lingering issues with those recordings. It was mainly just clicking from bad sample loops or poorly recorded/encoded samples. I imagine this was due to a combination of time crunch and crude audio tools during the soundtrack’s original creation, so I can’t fault Alex Brandon too much. Coincidentally, if you need to go insane, try finding the right loop points that make an audio sample not click and sound decent. 😛
Eventually, I ended up re-doing from scratch about a third of the soundtrack as I had also stupidly not saved the intermediate mod files from the original conversion. 😄 So, every one of the those bad 8-bit samples had to be cleaned up again. To be fair, I think I did an even better job with that as audio editors have gotten a bit more advanced in the interim. I’d like to redo the entire soundtrack, but many of the songs were pretty decent already and I’m kinda burnt out on it for now. But maybe in the future…
At this time, I’ve already uploaded the MP3 version of the new soundtrack conversion to its page. I’m still working on getting a new FLAC version done as it has a different tagging format. And I’m also thinking about making the intermediate mod files available for download, although obviously that would only include the tracks I redid recently. These files would be Impulse Tracker format with all the samples cleaned up and other fixes and new outros included. Additionally, I’m also exploring the possibility of copying the cleaned up samples back to the original UMX files to improve the game music as well.
Diablo 2 Mods
And in another kind of modding, Diablo 2 mods! Yes, I am still modding this old ass, janky game. However, that may be changing soon with the imminent release of the Remastered version of the game. Blizzard said modding is still possible in the new release, but I highly doubt it’s as comprehensive. I would be delighted to hear they switched the data format away from TSV text tables, though. I’d think something more object-oriented where you could define a default item, inherit and change what needs to in child items, and modify some of the raw functions would be the dream. But, I’d be pleased with at least a switch to JSON for the data definitions.
Regardless, I haven’t done too much modding this time around. I just overhauled how the respec and socketing mod works. I realized that I could just add the Token of Absolution—an item which resets your skill and stat point allocation—right to a vendor instead of continuing to use the Horadric Cube recipe. It’s a little janky this way as I had to change its item type to that of a potion to get the tooltip to work, but right-clicking on the ToA still gives the desired result, albeit with the drawback that the game crashes if you try to give the vendor more than one to sell, it can be put on your belt, and its cost changes based on what level the character is.
I also realized that I should include a recipe for adding sockets to items in the mod as there already is one but it’s crazy high-level and convoluted. Tangent, but, isn’t it lame how you have to “remember” all these cube recipes to play the game. We’re all looking them up on a wiki anyways and that’s not fun. I’m glad Diablo 3 got rid of that aspect. Anyways, I changed the recipe that adds sockets to something more reasonable but still balanced. And I also discovered that there was an unused recipe function that allowed gems to be removed from sockets without destroying them, so I added a new recipe for that as well. However, both of these recipes require gems to perform. I’ve been thinking about adding a new rare crafting material that could be used in the socket recipes, but it seems like a lot of work plus would take valuable inventory space even if the mats stacked.
I’m also thinking about removing the Magic Find attribute from my drops mod. It’s kind of a counter-productive stat to have on items, like it doesn’t help you survive or kill monsters but you want it maxed out so you can find the best loot. I just feel like the loot drops should always be good—in a fun and balanced way. So I might just remove magic find and increase the drop chances even more, but it’s a tough one because it needs lots of testing before release.
I hope you enjoyed this developer diary of a post. My apologies for not doing more awesomeness in recent years, but… it’s something at least. I think next I might try to give this site an overhaul; I’ve been neglecting to add proper mobile support for many years and the WordPress theme is like a decade old. I’m still dreaming of doing an update to Cursor Lock, though; I think it’s passed about a half-million downloads across all sites now. However, I’d really love to do a major update on File Lister as it’s the program of mine that I use the most. It’s just so crazy useful for doing batch operations and management on files, and I’d like to extend that capability.
Take care, everyone. Stay safe and don’t get the ‘rona!