4 ms·
Show HN: I wrote a partial re-implementation of DirectMusic
DirectMusic[1] is a deprecated Windows API for playing dynamic music scores authored using DirectMusic Producer[2]. It was originally released as part of DirectX in 1999 and discontinued with the release in Windows Vista around 2009-ish.
Due to my involvement with projects[3] re-implementing an old game engine for the early 2000's games Gothic and Gothic II[4], I came to notice that existing solutions[5] were incorrect and hard to use. Thus, I was tasked with writing a new, correct re-implementation of the API.
Today, my re-implementation is able to (mostly) play back so-called style-based segments[6] and is fully tested against both the Gothic and Gothic II soundtracks. I am actively working on getting the Lego Island 2 soundtrack working as well.
There are many features of DirectMusic which the library does not currently support, simply because I have not been able to find or test soundtracks using them, so if you want to contribute, I'd love to know about software shipping with DirectMusic soundtracks!
[1]: https://en.wikipedia.org/wiki/DirectMusic https://en.wikipedia.org/wiki/DirectMusic
[2]: https://www.vgmpf.com/Wiki/index.php?title=DirectMusic_Producer https://www.vgmpf.com/Wiki/index.php?title=DirectMusic_Produ...
[3]: Specifically GothicVR (https://github.com/GothicVRProject/GothicVR https://github.com/GothicVRProject/GothicVR) and OpenGothic (https://github.com/Try/OpenGothic https://github.com/Try/OpenGothic) through my ZenKit library (https://github.com/GothicKit/ZenKit https://github.com/GothicKit/ZenKit)
[4]: https://en.wikipedia.org/wiki/Gothic_II https://en.wikipedia.org/wiki/Gothic_II
[5]: There is libdmusic (https://github.com/libdmusic/libdmusic https://github.com/libdmusic/libdmusic) which is unmaintained and an embedded implementation in OpenGothic (https://github.com/Try/OpenGothic https://github.com/Try/OpenGothic)
[6]: https://documentation.help/DirectMusic/howmusicvariesduringplayback.htm https://documentation.help/DirectMusic/howmusicvariesduringp...
- nialv7 2y ago> I came to notice that existing solutions[5] were incorrect and hard to use. Didn't see you mentioning wine, are you not aware of it?
- teruakohatu 2y agoWine's first release containing very limited support came out in September 2023. Wine 9.0's release earlier this year contained "The foundation of several of the DirectMusic modules is implemented" which still sounds quite limited.
- nialv7 2y agoI just felt this is a missed opportunity to work collaboratively. Unless the author knows about wine and nonetheless chose to start a new project. Which is completely fine too.
- astrange 2y agoWINE doesn't allow contributions from people who know too much about actual Windows implementations iirc, so that could be a problem.
- lmichaelis 2y agoI was thinking about contributing to Wine, but I am not experienced with Windows native APIs. There is also a difference in how my library works and how DirectMusic worked originally. My library uses a "pull"-model, meaning the application must call a function to render more music. DirectMusic was more of an unattended "push"-model where you'd just tell it to play something and it'd set up playback automatically. It'd just play the music in a background thread (maybe even on hardware) and your application could subscribe to certain events (like get a callback on every beat).
- lmichaelis 2y agoI do know about the implementation in Wine, but sadly that one is not really useful for someone wanting to add support into a cross-platform app. Wine's implementation is tightly integrated with the Windows APIs it tries to recreate, so it has things like IUnknown and other Windows idiosyncrasies that aren't suitable for deployment as a library.
- asveikau 2y agoIUnknown is just a vtable. It isn't even code. There are cross platform projects that have used it. That said, I'm not knocking you for that, there likely are some win32 dependencies.
- teruakohatu 2y agoGood work. You may want to consider contributing code to the wine porject. Apparently Unreal 2, Final Fantasy 8 (original) and Midnight Club II use DirectMusic.
- cosmotic 2y agoI chatted with the music producer for One Must Fall: Battlegrounds years ago during development. He mentioned using direct music. https://en.m.wikipedia.org/wiki/One_Must_Fall:_Battlegrounds https://en.m.wikipedia.org/wiki/One_Must_Fall:_Battlegrounds
- pushfoo 2y ago> I'd love to know about software shipping with DirectMusic soundtracks! The Creatures series used procedural music for their MNG format[1] starting with Creatures 2, but I don't know if it's backed by DirectMusic. It may be on Windows, but I never did any disassembly to check. Regardless, thank you for posting something procedural which isn't backed by LLMs! [1]: https://creatures.wiki/MNG_files https://creatures.wiki/MNG_files
- robinduckett 2y agoIt is not backed by DirectMusic - the mng files just play wav files via whatever DirectSound equivalent for the platform (source files for the games are available in certain places)
- pushfoo 2y agoHello again, and thank you for checking! It's been a while since I've worked on anything Creatures-related. Are you still working on getting old things working on more recent platforms?
- monocasa 2y agoWhat are some of the libraries games use nowadays for game soundtracks?
- lmichaelis 2y agoFMOD[1] is a really big one being used in many modern games and Wwise[2] is also available. [1]: https://www.fmod.com/ https://www.fmod.com/ [2]: https://www.audiokinetic.com/en/wwise/overview/ https://www.audiokinetic.com/en/wwise/overview/
- ClimaxGravely 2y agoIn the last 10 years I'd say the majority of the projects I worked on used WWise. The audio people love it.
- lloydatkinson 2y agoOn an unrelated note I’ve been hoping someone would reimplement DirectPlay. There’s a childhood game that barely works on modern Windows as it is, and it has a networking component that allowed for either LAN or public internet play. The server was never made available and even if it was, I wouldn’t want to host a DirectPlay server from over 20 years ago online. Caveat is here I would prefer to write the server in C#. So if there was ever an open source implementation of DirectPlay for emulation/preservation reasons, I’d jump on the opportunity to get the game working again. Well it’s either that or I try do some reverse engineering of packets with wireshark…
- dolmen 2y agoCould you mention the name of that game?
- lloydatkinson 2y agoLego LOCO
- frabert 2y agoHi! Original author of libdmusic here -- kudos for the effort, I feel like I'm one of the very few people who know the struggle of getting useable audio out of original DirectMusic files :)
- hanslovsky 2y agoMan Gothic was such a good game. One of my all time favorites