Does anyone know how to play an already made midi file in QBasic? I have downloaded several peoples programs but they do not seem to work. Does anyone know of any code to play a midi file?
Thanks
TP :mrgreen:

Recommended Answers

All 5 Replies

helllooooooo? Does anyone know the answer to this mysterious and magical question? I have tried several programs to do this but none seem to work!!! Is there just a few lines of code I can use? Any ideas?
Thanks for your time even if you don't know the answer,
Pilky

helllooooooo? Does anyone know the answer to this mysterious and magical question? I have tried several programs to do this but none seem to work!!! Is there just a few lines of code I can use? Any ideas?
Thanks for your time even if you don't know the answer,
Pilky

It's been AGES since I've even messed with QBasic.... I am pretty sure there is a sound function (sound, snd, something like that) it might PLAY, but I don't remember. Anyway, you pass the function a value, a number of some kind, and it will play the sound. This has only worked through the PC Speaker for me, but it might work through real speakers. I'm guessing you might want to try something like... reading in the midi as binary, and passing those values to the function, in some kind of loop. I'm in Linux... so actually testing these out are ... well... you know.

Tom,
sorry couldn't do it in qbasic. Take a look at:
http://www.daniweb.com/code/snippet224.html
This short code is written in a more modern basic dialect called BCX-basic which makes it easy to write Windows GUI programs.

It is possible, and I've seen it before. But that was years ago on those big QB sites back in the 90's. qbt50.com and others. Not a clue which websites for QB are still around. But the code you want is out there.

If I remember correctly, the sound drivers written to handle everything were only for the sound blaster cards.

here is a file that plays midi in qb in the background, along w/ documentation. may take some tweaking. I've used this exact code in programs back in the day, so i know i got it to work somehow. If you're using anything but true dos, run under dosbox.

as for old school qb sites, check this 1999 mirror from the internet archive of qbasic.com:
http://web.archive.org/web/19990127152700/qbasic.com/qbindex.shtml

-gummo

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.