Creating a MIDI player in MS-DOS / BASIC

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
3,351
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Dec 13, 2010

In this tool-assisted education video, I demonstrate how to write a MIDI player from scratch.

Please see this page for more details, including the source code:
http://bisqwit.iki.fi/jutut/kuvat/programming_examples/midiplay.html

MIDI is a Music Interchange file format which describes music in abstract terms such as "piano key C-4 pressed down". A synthesizer is required to reproduce audible music from MIDI files. In this tool-assisted education video, I create one such synthesizer program from scratch, using the OPL3 hardware synthesizer as the backend for generating the actual sounds.

You see me type every line. The resulting program contains the rudimentary features for playing most MIDI files just fine, including the pitch slides and pans, but it lacks other special effects like vibrato, nor does it support any more tunings than the standard equal-interval mathematical tuning. It supports the loopStart/loopEnd mechanism found in authentic Final Fantasy VII MIDI files.

This is probably my best MS-DOS MIDI player so far (at least in some aspects), and I have written two. The first one, written in 1998, however eventually evolved also to convert them into S3Ms...
This was also the most difficult production-for-show so far in terms of getting it right; BASIC has its own unique challenges at debugging it, and I did accidentally introduce many bugs into this program, despite writing it from a script. I did fix them too, though. But more time was consumed doing that than I had planned.

Music played during this video:
- Zoolook by Jogeir Liljedalh (a few seconds in the beginning)
- Predicament / Chrono Cross (BGM during programming)
- Chmmr and Arilou themes / Star Control III (MIDI)
- Barret and battle themes / Final Fantasy VII (MIDI)
- Airship and Big whale themes / Final Fantasy IV (MIDI, sequenced by Andrew Thompson)

My favourite part of this video: 08:53 onwards.

P.S. Eventually this program evolved into a C++ opensource project! Check it out here: http://bisqwit.iki.fi/source/adlmidi.html

  • likes, 1 dislikes

Link to this comment:

Share to:

Uploader Comments (Bisqwit)

  • You have to use CTRL-Scroll lock now instead of CTRL - Break.

  • @kiyotewolf Thanks for the tip: It did not work, though. I tried it, back then. DOSBox simply does not generate the break signal.

  • OPL sounded amazing

    

  • @mattedj The attraction with it for me is that it allows for great music without the use of any copyright data - e.g. audio recordings, i.e. samples. (And I cannot choose good samples anyway.) With OPL, it's just input a few numbers, and there you have a good instrument.

  • Wow, GW-BASIC still being used in 2010?!  O__o

    I remember writing small programs with it as a child in the early 90s :-)

    I even created a stupid "key smasher" game in GW-BASIC complete with characters and animations made in Autodesk Animator (shown through AAPLAY with the shell command xD). It was a terrible game but fun to play with friends :-)

  • @OMA2k I use it for creating entertaining videos. Pretty much for nothing else. I use QBasic marginally more (in the recent 8 years or so, PHP took its place for me), but for these videos, sometimes GW-BASIC is the handier tool, because it naturally allows for more concise implementations. Also, I can have syntax highlighting for GW-BASIC within its "IDE", which I cannot do for QBasic. (In a recent video, I used an editor that I created myself to provide similar experience for QBasic.)

see all

All Comments (14)

Sign In or Sign Up now to post a comment!
  • @OMA2k

    Gw-Basic is fun, it's what I started with on IBM-Compatibles. I still tinker with it.

  • @supepat GW-BASIC.

  • wich program are you using?

  • @waytostoned PAS8 unfortunately does not contain OPL3, which this program requires (for panning). You need PAS16 or some other card that has OPL3. You can make this program OPL2 compatible with little changes, though. (It might even work verbatim, with reduced functionality, but I cannot guarantee it.)

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more