# DirectMusic: an open reimplementation of Microsoft’s music API

> Re-implements DirectMusic, the adaptive-soundtrack API Microsoft shipped with early DirectX, as a portable C11 library that loads a game’s segment, style and DLS instrument files and renders the music to PCM. The README lists only the Gothic and Gothic II (Night of the Raven) soundtracks as tested, and as working “somewhat” correctly; the project calls itself incomplete and under heavy development. Instruments play through a vendored TinySoundFont synthesizer after DLS-to-SoundFont conversion.

- Type: Case study
- Targets: Game
- Category: Independent reconstruction cases
- Relationship: Independent reconstruction project
- Sources reviewed: 2026-10-19
- Added to the catalog: 2026-11-09
- Original resource: <https://github.com/GothicKit/dmusic>
- Primary source: <https://github.com/GothicKit/dmusic/blob/b73b270b94714b8ec8d9d0b2a9f3a5c445da52d1/README.md>
- Catalog page: <https://awesomerea.org/resources/dmusic-directmusic-reimplementation-case/>
- Record JSON: <https://awesomerea.org/resources/dmusic-directmusic-reimplementation-case/record.json>
- Chinese version: [简体中文](https://awesomerea.org/zh/resources/dmusic-directmusic-reimplementation-case/index.md)

## Requirements & limits

- The C11 library exposes its own DmLoader, DmSegment and DmPerformance API. End-and-intro embellishment, some curves and message types remain unimplemented.
- Users supply their own .sgt segments, .sty styles and .dls collections from game data through a resolver callback; the repository ships none of these files.
- Building needs a C11 compiler and CMake 3.10+. Linux, macOS and Windows are supported. The play-segment example needs <unistd.h> and <sys/stat.h>.
- The README reports the Gothic and Gothic II soundtracks working “somewhat” correctly. CI builds the library for Linux, Android, macOS and Windows; no test suite or Microsoft runtime output comparison is listed.
- LICENSE.md grants the MIT License (Modern Variant) for project code. TinySoundFont, miniaudio and the Gothic II theme rendering have separate rights; game music retains its rights.

## Primary sources

1. <https://github.com/GothicKit/dmusic/blob/b73b270b94714b8ec8d9d0b2a9f3a5c445da52d1/README.md>
2. <https://github.com/GothicKit/dmusic/blob/b73b270b94714b8ec8d9d0b2a9f3a5c445da52d1/include/dmusic.h>
3. <https://github.com/GothicKit/dmusic/blob/b73b270b94714b8ec8d9d0b2a9f3a5c445da52d1/CMakeLists.txt>
4. <https://github.com/GothicKit/dmusic/blob/b73b270b94714b8ec8d9d0b2a9f3a5c445da52d1/src/util/Tsf.c>
5. <https://github.com/GothicKit/dmusic/blob/b73b270b94714b8ec8d9d0b2a9f3a5c445da52d1/src/Performance.c>
6. <https://github.com/GothicKit/dmusic/blob/b73b270b94714b8ec8d9d0b2a9f3a5c445da52d1/src/_Internal.h>
7. <https://github.com/GothicKit/dmusic/blob/b73b270b94714b8ec8d9d0b2a9f3a5c445da52d1/examples/play-segment.c>
8. <https://github.com/GothicKit/dmusic/blob/b73b270b94714b8ec8d9d0b2a9f3a5c445da52d1/.github/workflows/build.yml>
9. <https://github.com/GothicKit/dmusic/blob/b73b270b94714b8ec8d9d0b2a9f3a5c445da52d1/LICENSE.md>
10. <https://dm.gothickit.dev/>

## More in Games

- [Dishonored: reconstructing Windows XP compatible storefront DLLs](https://awesomerea.org/resources/dishonored-xp-stub-case/index.md) · Case study
- [DLSSNR-AMD: reimplementing DLSS 5 neural rendering for RDNA4](https://awesomerea.org/resources/dlssnr-amd-neural-rendering-case/index.md) · Case study
- [dndserver: a replacement Dark and Darker server](https://awesomerea.org/resources/dndserver-case/index.md) · Case study
- [Dodge It: annotated Fairchild Channel F disassembly](https://awesomerea.org/resources/dodge-it-videocart-16-case/index.md) · Case study
- [Does reverse engineering need a bigger model? General and specialist models in Touhou reconstruction](https://awesomerea.org/resources/rea-bigger-model-essay-case/index.md) · Case study
- [Dogfish: reconstructing Conquest of Skyrim's strategic systems](https://awesomerea.org/resources/dogfish-conquest-of-skyrim-case/index.md) · Case study

## About this entry

The description was reviewed against primary sources.
Original editorial content: MIT. Linked projects, papers and assets retain their own rights and licenses.
