VOGONS


DOSMid - an open-source MIDI player for DOS

Topic actions

First post, by mateusz.viste

User metadata
Rank Member
Rank
Member

Here I present DOSMid, an open-source MIDI player for DOS.

Today I released a new version of DOSMid, the v0.8. In this version I added support for additional hardware, fixed a few minor bugs, and optimized the code so DOSMid runs comfortably on an 8086 (wanna see? here's a video of DOSMid running on an 8086 with 256K of RAM and a mono screen: https://youtu.be/8ssDGBTssUI ).

DOSMid's homepage: http://dosmid.sourceforge.net

Complete changelog below:

- SBMIDI support (can drive MIDI synths attached to SB 1.x and 2.x cards), - serial (RS-232) output support (/com=xxx or /com1.. […]
Show full quote

- SBMIDI support (can drive MIDI synths attached to SB 1.x and 2.x cards),
- serial (RS-232) output support (/com=xxx or /com1..4),
- implemented 'controller' MIDI support on OPL output,
- added support for relaying SYSEX messages to the MIDI device,
- DOSMid adds a 2s silence gap before each song,
- support for monochrome video modes (autodetected),
- fixed parsing of hex I/O ports with non-numerical chars (like "3f8"),
- reduced timing inaccuracy from ~0.02% to <0.005% (relies on PIT's quality),
- restoring initial video mode after DOSMid quits,
- reliable detection and reporting of out of memory conditions,
- /noxms handles more than 64K of memory (bigger files can be played),
- support for custom SYSEX initialization via a SYX file (/syx=FILE),
- "expensive" features can be easily disabled at compile-time (AWE, OPL),
- screen refresh optimizations - runs without lagging on my 8086 now.

Reply 1 of 151, by keropi

User metadata
Rank l33t++
Rank
l33t++

Excellent I will try it later 😀
Can it play large midi files (bigger than 500kb for example) ?

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 2 of 151, by mateusz.viste

User metadata
Rank Member
Rank
Member
keropi wrote:

Can it play large midi files (bigger than 500kb for example) ?

I don't have such big MIDI files to test (have some links to such monsters? I'd be curious to see), but in theory - yes, it should play such files without troubles if you have enough XMS memory.

Reply 3 of 151, by keropi

User metadata
Rank l33t++
Rank
l33t++

I just tested on my 200mmx build with a MPU401AT interface + MT-32, DOSMID can play a 1.5MB midi file just fine! It take a little to load but it works - that's a first in DOS midi players , we were always limited by the amount of free conventional memory. So glad to see a working solution to this.

I am attaching a zip file with some MT-32 soundtracks from the Quest Studios website , there are some really large one midis in there that work for the first time under DOS 😎

Kudos on the player mateusz.viste!
btw, have you considered giving the option to use a small config file so users like me don't have to always use "/mpu=330" when there are both SB and dedicated mpu installed on the system? One other suggestion would be to make the player assume .mid so a command like this works: dosmid lsl3mt (lsl3mt.mid is the file we want to play)

Attachments

  • Filename
    QS_MIDI.ZIP
    File size
    3.42 MiB
    Downloads
    372 downloads
    File comment
    Some midi soundtracks from Quest Studios
    File license
    Fair use/fair dealing exception

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 5 of 151, by keropi

User metadata
Rank l33t++
Rank
l33t++

I also notice that if you let DOSMID load the corresponding *SYX file before playback the MT-32 displays the "buffer overflow" error. On the same setup the DUMP.EXE util does not produce that error (dump.exe was in the Quest Studios site here: https://web.archive.org/web/20130120051532/ht … /utilities.html)

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 6 of 151, by dr_st

User metadata
Rank l33t
Rank
l33t

Awesome player! And it plays MUS files as well!

Is there a way to get it to load an alternate instrument bank for MUS files? Comparing to MUSPlay by V. Arnost, I find that it sounds exactly the same when playing through DOSBOx's MPU-401, but quite different when playing through the OPL emulated at port 388h. MUSPlay sounds nicer in this case (using the original Genmidi lump from DOOM).

It could be related to the general remark by leileilol about certain instruments being off-key...

https://cloakedthargoid.wordpress.com/ - Random content on hardware, software, games and toys

Reply 7 of 151, by PhilsComputerLab

User metadata
Rank l33t++
Rank
l33t++

Very nice! Always useful to have DOS tools rather than having to install Windows 9x 😀

YouTube, Facebook, Website

Reply 9 of 151, by thierry

User metadata
Rank Newbie
Rank
Newbie

Exelent ! , works perfect in my 386 DX40MHZ 8mb RAM , SBPRO conected to MT32 , great program , any chance of having a file selector in the same program? .. Thank you !

Reply 10 of 151, by mateusz.viste

User metadata
Rank Member
Rank
Member

Hi!

First of all, I'm really sorry for my quite long response time. To tell the full truth, I'm not a big fan of these "forum" things (I'm more of a usenet guy), so I rarely check out here. And for some reasons, vogons didn't notified me about this thread's activity even though it appears in my "watched threads" list.

keropi wrote:

btw, have you considered giving the option to use a small config file so users like me don't have to always use "/mpu=330" when there are both SB and dedicated mpu installed on the system?

I am unsure whether such config file would really have a significant added value... DOSMid will use by default whatever is set in your BLASTER variable, so if it contains the correct port of your dedicated MPU, then that's what will be used. And even if you'd like to use a custom port specifically for DOSMid, then it's just a single batch file away:

@DOSMID /MPU=330 %1 %2 %3

Nonetheless, I can understand why one would prefer a configuration file, as it might appear "cleaner" than a custom *.bat... So yes, I will most probably add such (optional) config file support.

leileilol wrote:

I've noticed some instruments are off-key on some certain midis in OPL mode...

Well, DOSMid's OPL support is kind of a "proof of concept" - I developed it mostly because I wanted to see if I would be able to.. But it's far from perfect. What you mean, I guess, is that some MIDI files played via OPL sound different than what they sound in other contexts (in-game or so). This is related to the fact that I hard-coded 'generic' OPL instruments inside DOSMid, while most OPL-playing applications used to provide their own sound fonts. Hence the solution would be to make it possible to feed DOSMid with an OPL sound font file - and this is something that I certainly plan to do, at some point in the future.

keropi wrote:

if you let DOSMID load the corresponding *SYX file before playback the MT-32 displays the "buffer overflow" error.

Is your MT-32 a "rev00" model by any chance? Sadly, I do not own a MT-32 myself, so I can't test, but I hear these tends to be quite sluggish when it comes to sysex processing. I added an additional delay of 40ms between each SYX event, and an additional 200ms delay for specifically for the "reset all parameters" event which might need a longer time to reinit the hardware. Could you please tell me if your "buffer overflow when loading SYX" problem still happens when using the version below?

http://mateusz.viste.fr/temp/dosmid-mt32/dosmid.exe

dr_st wrote:

Is there a way to get it to load an alternate instrument bank for MUS files?

It's not really a MUS-related question. I take you play MUS files via an OPL (as opposed to a wavetable MIDI processor), so the answer I wrote to leileilol also applies (that is, "need to implement custom OPL soundfont support - on the roadmap, but can't commit to any deadlines for now").

thierry wrote:

any chance of having a file selector in the same program?

Yes, this is something I plan to add for the DOSMid v1.0 (to be expected before 2020). :) Unfortunately my spare time is very rare these days, and it doesn't look like this situation is going to improve, so while I am still very into retro-computing development, I hardly get the time to get anything bigger done.

Reply 11 of 151, by mateusz.viste

User metadata
Rank Member
Rank
Member

Hello,

I'm glad to announce that DOSMid has been released in an updated version today.

  • DOSMid v0.9 [21 May 2016]
  • increased SYX delaying to 40ms (solves buffering troubles on MT-32 gears),
  • fixes around how OPL percussion instruments are emulated,
  • support for custom sound banks (IBK on OPL, SBK on AWE),
  • a configuration file allows to set default settings (dosmid.cfg),
  • the 2s silence gap before songs is inserted only in playlist mode now,
  • sound hardware is initialized once, instead of being inited for every song,
  • fixed playlist parsing so DOSMid won't freeze on an empty m3u playlist,
  • load more textual information from the MIDI file (titles, markers, text),
  • file's information is displayed on a dynamic scroll when over 5 lines,
  • reorganized the display so more MIDI textual data fits on the screen,
  • fixed OPL detection for cards intolerant to hw calls during init (CT2760),
  • command-line arguments are case-insensitive,
  • renamed the /delay command-line option to /xmsdelay,
  • DOSMid refuses to play corrupted files, instead of ignoring MIDI errors.

homepage: http://dosmid.sourceforge.net

Reply 12 of 151, by James-F

User metadata
Rank Oldbie
Rank
Oldbie

First, excellent player! The only one that actually sends SysEx from a mid file on my machine without having to tweak the sound blaster, using the MPU port.
Kudos!

I can't make SYX files to work win DOSMid.
No matter what I write after /syx="********" the return is always "Error: You have to provide the path...."

EDIT:
Okay, it had to be sent together with a MID file. But WHY?
I just want to initialize the unit with a SysEx Reset command without actually playing anything or applying the patch list DOSmid sends when it exists.
Even worse, when I load the MT32EMUL.MID which sets custom instruments to all channels, DOSMid overwrites them on exit.

Why the custom patch list when starting or exiting DOSMid?
When I play a GS_Reset.MID with nothing but a single SysEx inside, I want the unit to stay initialized, not have a custom patch list.

All Notes, All Sounds to OFF = alright.
Midi Volume sysex to Max = alright.
Custom Patch list = Totally Not Cool!

Moreover, this list sets patch 09 to Drums???
Do you realize there is no such patch on channel 10 for drums and many synths will have silence instead of drums!

Anyway, I don't know the reason for that patch list on enter or exit but it's definitely does more harm than good with MPU and real synths.

Last edited by James-F on 2016-06-10, 05:25. Edited 2 times in total.


my important / useful posts are here

Reply 13 of 151, by ElBrunzy

User metadata
Rank Oldbie
Rank
Oldbie

Hi Mateusz, I'm so glad you maintain this project! Make sure that I use it a lot for to enjoy my music collection on vintage sound cards such as the ADLIB or the SBPNP32 (using the OPL3 or the EMU8k). Considering the offer, I think you might have what could be the best dos midi player in your hands. I have read many of the file in your source code and they are examples of how to lay down a project and how to document it, it's barely believable that you made all this alone, have you?

I'm sorry to get back to you with that, but if I found a good GM.IBK in the CakeWalk5demo directory, I have yet to find some good general midi drum .IBK file. I am sure you should package DOSMid with an instrument and drum .IBK file, could encourage people to use your support for custom sound banks on opl soundback.

I have hear that someone here coded some sf2 support but due to dos real mode, he could not just only load the .sf2 into the emu8k ram and let it wait here for some player to use it like in windows. I think you should get in touch with that guy and merge his sf2 loading routine with your emu8k .mid player, that would really get you one step beyond.

Reply 14 of 151, by mateusz.viste

User metadata
Rank Member
Rank
Member
James-F wrote:

I can't make SYX files to work win DOSMid.
No matter what I write after /syx="********" the return is always "Error: You have to provide the path...."

Can you please provide the full command line you execute, as well as the exact version of DOSMid you use?
Note, that your example above contains quotes around the syx filename. These should be removed. Example:

dosmid canyon.mid /syx=myinit.syx

Tested it right now on DOSMid v0.9, works for me.

Why the custom patch list when starting or exiting DOSMid?

The patch is far from "custom", it's simply a reset to default GM assignations.

When I play a GS_Reset.MID with nothing but a single SysEx inside, I want the unit to stay initialized, not have a custom patch list.

This is what the /syx feature is designed for. If it doesn't work, it needs to be fixed, but for that I'd need to know more about your trouble (see my previous questions).

Moreover, this list sets patch 09 to Drums???
Do you realize there is no such patch on channel 10 for drums and many synths will have silence instead of drums!

Indeed, the channel 9 reset could be removed. I just iterate through channels from 0 to 15 and point them to instruments 0 to 15 now. Didn't care about skipping the special-case channel 9, but you are right that it would be cleaner to. All synths I tested are fine with it, though. Have you actually run into the "silent drums" trouble? I'd be curious to know on what synth hardware.

Anyway, I don't know the reason for that patch list on enter or exit but it's definitely does more harm than good with MPU and real synths.

The patch list reset happens before loading every MIDI file. Why? Simply because I have MIDI files that expect the synth to have standard GM patches pre-loaded in the default order. Without the reset, playing such MIDI file right after one that changed the patch set leads to funky results (ever listened to Scott Joplin playing on flutes?). :)

Reply 15 of 151, by James-F

User metadata
Rank Oldbie
Rank
Oldbie
mateusz.viste wrote:

The patch list reset happens before loading every MIDI file. Why? Simply because I have MIDI files that expect the synth to have standard GM patches pre-loaded in the default order. Without the reset, playing such MIDI file right after one that changed the patch set leads to funky results (ever listened to Scott Joplin playing on flutes?). 😀

This is absolutely not true!
The default midi instruments after a GM reset on any synth are channel 1-16 Piano.
Your player is the only one among many other players that does anything but 1-16 piano list.
You fixed your broken midi but destroyed countless others that expect instrument 0 (piano) on all channels after reset (Drums on channel 10).
"standard GM patches in the default order".. where did you read that? There is no such thing in the 25 years of midi existence.

Here is the most complete midi player available on the PC: Falcosoft Soundfont Midi Player + Munt VSTi + BassMidi VSTi
I helped Falcosoft debug and improve this player to perfection.
You can ask him if there is such thing as "standard GM patches in the default order".
Or you can check it's midi behavior at Start/Stop (1-16 piano obviously).

Having said that, next is the SysEx command that doesn't work (using DOSMid 0.9).
Here is my full command:

dosmid.exe /syx=reset.syx

Yes I know it doesn't work because I have not added a MID file to the command, but I wish it did to avoid your custom instrument list.
Running only GS_Reset.MID destroys the Reset by applying your custom instrument list at the end... why would you do that? 😵
I also have MT32EMU.MID that pre-loads a custom patch list to emulate the MT-32 on the SC-55, but again. your player destroys that.
I am talking strictly about MIDI (MPU-401) here, not OPL or other options.
Again, I have no idea where you read about "standard GM patches in the default order" but that simply not the way to do it.
Is suggest you fix your broken MIDIs instead of forcing the world to use a custom instrument list. 😉

If I may request to have an option to apply ONLY "All Notes Off", "All Sounds Off" and "Reset Control" when using MPU mode, that will solve many problems.
An option to run a custom Sysex at Start and/or at Stop will be very useful, many other player do that including the one I noted.
In other words, "All Notes Off", "All Sounds Off" and "Reset Control" are default and everything other should be optional/user customizable.
In other other words, please remove this utterly pointless and destructive instrument list at the end.

Thanks.


my important / useful posts are here

Reply 16 of 151, by mateusz.viste

User metadata
Rank Member
Rank
Member

Hi James, thank you for your hints! The MIDI files that were going crazy without resetting channels were all Scott Joplin tunes I like to listen to from time to time (obviously all piano), and almost all of them use channel 0 exclusively - that's why it was working in my case. The patch reset itself won't go away, because I need it, but I will definitely change it to "all piano" instead "0..15".

The second problem you describe is that my reset destroys your syx initialization - this I agree is pretty sad. I haven't checked yet, but suspect it's simply because I call it in the wrong order, that is "apply syx" followed by "apply reset", instead of the other way around. I have a 10h flight ahead of me today so I will surely fix that in the plane. I will get back here when done.

As for using DOSMid to only apply a sysex - well, that's not the goal of DOSMid. Surely there are much simpler and specialized tools out there for just that. I believe though that changing my reset to "all piano" and running SYX *after* the piano reset will solve both your troubles, right?

Reply 17 of 151, by mateusz.viste

User metadata
Rank Member
Rank
Member

Actually I hacked it quickly right now, while still on the ground. James, could you please confirm that this version works better for you?
http://mateusz.viste.fr/temp/dosmid-james/

Reply 18 of 151, by James-F

User metadata
Rank Oldbie
Rank
Oldbie

Hi mateusz, thank you for addressing this so quickly.

Thank you for changing it to 1-16 piano, like it should be.
1. The test version applies the "apply reset" sequence TWICE at start and nothing at exit (bug).
2. The "apply syx" should be BEFORE the "apply reset" but only at start.
3. At exit, do NOT apply the instrument piano list or the Sysex, only Notes, Sounds, Ctrl Offs.

SysEX -> "apply reset (w/ piano list)" -> Play Midi -> "apply reset (NO piano list)"
That may mean that you'll have to have two reset lists in your code.

The reason for not having piano list or sysex at exit is because the attached MT32EMU.MID sets custom instrument list (using sysex commands) so DOS games can use the SC-55 in MT32 mode,
so we do not want to overwrite that at exit with sysex or with other instrument list.
It doesn't matter if you leave the patch list as-is at exit in any case.
Most games do just that at exit, leave the patch list as-is, never harmed anyone yet.

I you want, you can have an option to apply the Sysex at exit too, but that should be decided by the user.

That's all there is to it.

EDIT:
Fixed the order, please read again.
Sorry about that. 😊

Attachments

  • Filename
    MT32EMUL.zip
    File size
    615 Bytes
    Downloads
    226 downloads
    File license
    Fair use/fair dealing exception


my important / useful posts are here

Reply 19 of 151, by mateusz.viste

User metadata
Rank Member
Rank
Member
James-F wrote:

1. The test version applies the "apply reset" sequence TWICE at start and nothing at exit (bug).

Yes, I know. First time is during initialization, second time just before starting the playback. I might optimize it later, but it's not that important after all (meaning nothing harmful could result from this).
Nothing at exit - this is on purpose, too. I don't touch the MPU once I played the file, so this opens the possibility of using DOSMid for some kind of initialization-only stuff, even though that is not its primary purpose.

James-F wrote:

2. The "apply syx" should be BEFORE the "apply reset" but only at start.

I am not sure I follow why. The SYX file could very well wish to set things like volume, pre-load some patches, etc. Running the 'apply reset' afterward would undo actions that the user tried to execute via the SYX.

James-F wrote:

3. At exit, do NOT apply the instrument piano list or the Sysex, only Notes, Sounds, Ctrl Offs.

As you observed, I do nothing at exit since yesterday's version.