Bucket Posted December 23, 2020 (edited) Today I've gone spiraling down a rabbit hole regarding Doom's .MUS format, thanks to some resurfacing problems with MIDI composition. While Doom has supported MIDI since v1.666, it seems like some remnants of the DMX sound library (that apparently the team were not fond of) are still showing symptoms today. According to this page, Id were either unable or unwilling to secure the rights to distribute the DMX sound library when they released the Doom source so engineering a solution short of a complete rewrite is probably beyond most people. So here are a few bullet points: DMX was intended to be a catch-all for a range of setups, from PC speaker to Gravis Ultrasound. Adlib/OPL-FM programming was very different from the MIDI standard and it seems MUS was intended to bridge the gap, and as such MUS is functionally like a MIDI but more or less caters to Adlib limitations. I imagine Bobby Prince composed with MIDI software but with OPL limits in mind. So to revisit the conversation about Pitch Bend Depth not being reset between songs: Doom doesn't do this because MUS doesn't do this. Naturally, the default is two semitones with no option to change it. Here are all the controller events it supports according to this page: Quote Change instrument (MIDI event 0xC0) Bank select: 0 by default Modulation (frequency vibrato depth) Volume: 0-silent, ~100-normal, 127-loud Pan (balance): 0-left, 64-center (default), 127-right Expression Reverb depth Chorus depth Sustain pedal (hold) Soft pedal Chorus and reverb are interesting inclusions since not a lot of sound cards I've owned support it (the Windows software synth certainly doesn't). Incidentally, the MUS format includes the MIDI System Event "reset all controllers" which would ostensibly include the ones not explicitly supported... but I have yet to test it. Another interesting discovery that I'd suspected for a long time: MIDI channel mapping for OPL compatibility. According to this PDF Adlib-compatibles have 18 "operators" (sound generators) that can be doubled up to produce either 9 channels of music or 5 music + 5 drum sounds. (The kick drum gets 2 layers while the snare, hat, tom, and cymbal get 1.) To get around this limitation, MUS remaps MIDI channels to 9 Primary, 5 Secondary, and 1 Percussion. Channel 10 is moved to 16 for super secret reasons; if I were to guess, that decision probably has something to do with drum notes outside of the measly 5 sounds supported by OPL. I'm pretty sure Adlib can play drum sounds at any pitch - toms definitely do that in Doom - so maybe it's related. Or maybe it's a sloppy hack because in the words of John Romero, the creator of the DMX library has "demonstrated in the past year and a half that he's incompetent." Moving on... Primary channels have priority over Secondary, meaning that notes in the Secondary channels will get dropped if the polyphony limit is reached. It's also worth mentioning that you can set a hardware-agnostic event to Mono or Poly, meaning that if a channel contains chords it seems that MUS will attempt to sort the extra notes into other channels. OPL is strictly monophonic and it looks like this feature was included just for that. I have no idea why the later implementation of MIDI was still subject to some of these quirks. I can only assume they used the same library because, as hard as it was to work with, excising the whole thing would've been harder. You know how subcontractors are; getting them to support their own software is like pulling teeth. They'll only implement new features if you can demonstrate that a workaround is impossible. Edited December 23, 2020 by Bucket 12 Quote Share this post Link to post
wrkq Posted December 25, 2020 On 12/23/2020 at 6:05 AM, Bucket said: I have no idea why the later implementation of MIDI was still subject to some of these quirks. I can only assume they used the same library because, as hard as it was to work with, excising the whole thing would've been harder. You know how subcontractors are; getting them to support their own software is like pulling teeth. They'll only implement new features if you can demonstrate that a workaround is impossible. Not that I've done any research of my own but the line of information I see everywhere about this is that DOOM's MIDI support is not actually "we can play MIDI", it's a "we embedded the midi2mus converter and autoconvert any MIDI files found in the WAD during (level?) startup". All playback is still done by DMX, which reads MUS, and so you still have the 9 channels / 64k filesize / etc limits. 2 Quote Share this post Link to post
P41R47 Posted December 25, 2020 interesting research, Bucket! So, for things to work right, on vanilla settings, every midi must end with an event to reset all controllers? 0 Quote Share this post Link to post
wrkq Posted December 25, 2020 Not end, start. Songs are looping, and you never know when a song will get interrupted and next song will start playing (new level, new game, etc). You cannot "clean up after yourself" to make any next song work. Each song must begin with resets/reconfigurations to set all the parameters to the values this song needs. 1 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.